std-random | ![]() ![]() |
(std-random <num>)
Pseudo random generator.
Returns any number lower than num, with the same numerical type as num.
If the argument is nil, 1.0 is assumed.
(std-random 5) =>
0 - 4
(std-random 1.0) =>
0.0 - 0.999...
To initialize the random generator (set a random seed or change the used method) use std-make-random-state but this it is only required if you want a reproducible random sequence or a better quality.
num: integer or real or nil.
Returns a number lower than num, with the same numerical type as num.
Changes and uses the global variable *random-seed*.
(std-require 'STDMATH)
or (std-require 'RANDOM)
Defined in STDMATH and in RANDOM