up previous next
random

random integer

Syntax
random(X: INT, Y: INT): INT

Description
The function returns a random integer between X and Y , inclusive. The range |X-Y| should be less than 2^33 to ensure a uniform distribution.

NOTE: every time you restart CoCoA the sequence of random numbers will be the same (as happens in many programming languages). You can change this by using reseed .

Example
/**/  random(1,100);
6

/**/  random(-10^4,0);
-3263

See Also