The random extensions provide functions for seeding and generating pseudo-random numbers. These extensions may or may not be present depending on the platform and configuration of LispBM.
seed sets the seed of the random number generator. The form of a seed expression is (seed expr) where expr must evaluate to a number. Returns t.
| Example | Result |
|
|
|
|
random generates the next pseudo-random number. The form of a random expression is (random). Returns an unsigned integer (type-u). The range of values and the algorithm used are platform-dependent. In the LispBM reference implementation a linear congruential generator is used and values are in the range 0 to 268435182, chosen to fit within the 28-bit value range of type-u on 32-bit platforms.
| Example | Result |
|
|
|
|
|
|
|
|
This document was generated by LispBM version 0.36.0