random() : var

Returns a random number uniformly distributed in the range from -1.0 to +1.0 (borders not included). Uses the Lehmer algorithm with a period of 2,147,483,646.

random(var Max) : var

Returns a random number uniformly distributed from 0 up to, but not including Max.

seed(int s)

Initiates a fixed random number sequence, dependent on the "seed" s. Affects random, randomize, and Detrend.

Example:

if(is(INITRUN)) 
  seed(365);
...
if(random() > 0) ... // true in 50% of all cases

See also:

abs, sign, randomize, Detrend

► latest version online