random number generator
(optional) numeric range or positive integer
With no arguments, the call rand() returns a random integer sampled uniformly from the range 0 to 1012-1.
If the parameter r is an integer range a..b, the call rand(a..b) returns a procedure which, when called, generates random integers in the range a..b.
If r is a numeric range a..b and one of a or b is not an integer, the call rand(a..b) returns a procedure which, when called, generates random floating-point numbers in the range a..b.
If r is a single integer, the call rand(r) is the abbreviated form of rand(0..r-1).
More than one random number generator may be used at the same time, because rand(a..b) returns a Maple procedure. However, since all random number generators use the same underlying random number sequence, calls to one random number generator will affect the random numbers returned from another.
rand calls RandomTools[MersenneTwister][GenerateInteger] or RandomTools[MersenneTwister][NewGenerator] depending on whether or not a number or procedure is to be returned. It is more efficient to make these calls directly than to call rand.
The random number generator used by rand can be seeded by using the randomize or RandomTools[MersenneTwister][SetState] functions.
The use of the _seed global variable to seed the generator is deprecated.
The algorithm used by rand in Maple versions up to and including 9.5 has been moved into the RandomTools package as RandomTools[LinearCongruence].
To generate more complex Maple objects, the RandomTools[Generate] function can be used.
To sample from non-uniform probability distributions, the Statistics[Sample] function can be used.
roll ≔ rand⁡1..6:
sampleFloat ≔ rand⁡1.0..6.0:
The rand command was updated in Maple 2015.
Download Help Document