Seeds the random number generator state used by IO.rand.
21.10. 随机数
Returns a pseudorandom number between lo and hi, using and updating a saved random generator
state.
This state can be seeded using IO.setRandSeed.
Generates a random Boolean.
Generates a random natural number in the interval [lo, hi].
21.10.1. 随机生成器
Interface for random number generators.
Instance Constructor
RandomGen.mk.{u}
Methods
range : g → Nat × Nat
range returns the range of values returned by
the generator.
next : g → Nat × g
next operation returns a natural number that is uniformly distributed
the range returned by range (including both end points),
and a new generator.
split : g → g × g
The 'split' operation allows one to obtain two distinct random number generators. This is very useful in functional programs (for example, when passing a random number generator down to recursive calls).
21.10.2. 系统随机性
Reads bytes from a system entropy source. It is not guaranteed to be cryptographically secure.
If nBytes is 0, returns immediately with an empty buffer.