Seeds the random number generator state used by IO.rand
.
15.10. Random Numbers
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].
15.10.1. Random Generators
RandomGen.{u} (g : Type u) : Type uRandomGen.{u} (g : Type u) : Type u
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).
StdGen : TypeStdGen : Type
"Standard" random number generator.