Picking a random number

 
 
 

The rand command generates a random floating point number. If you give one argument, it returns a number between 0 and the argument:

rand(1000);
// Result: 526.75028 //

If you give two arguments, it returns a random number between the first and second arguments:

rand(100,200);
// Result: 183.129179 //

See also the sphrand, gauss, and seed commands.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License