View Single Post
  #5 (permalink)  
Old 07-27-2007, 09:24 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Quote:
In old-fashioned QuickBASIC (MS-DOS days), the keyword RND returned a float (a SINGLE, as in single-precision floating-point type) between 0 and 1. To change the values, you actually had to multiply rather than use the modulus operator:
LOL! We use the same thing in Java to generates double random value!

Here's how Java generates double random value:
Code:
Random r = new Random();
r.nextDouble(); // Generates double between 0.0 and 1.0
r.nextDouble() * 10; // then generates random number between 0.0 and 10.0

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by HelloWorld : 07-27-2007 at 09:26 AM.
Reply With Quote