Seeds the random number generator state used by IO.rand.
15.10. Random Numbers
IO.rand (lo hi : Nat) : BaseIO Nat
Returns a pseudorandom number between lo and hi, using and updating a saved random generator
state.
This state can be seeded using IO.setRandSeed.
randNat.{u} {gen : Type u} [RandomGen gen]
(g : gen) (lo hi : Nat) : Nat × genGenerates a random natural number in the interval [lo, hi].
15.10.1. Random Generators
RandomGen.{u} (g : Type u) : Type uInterface 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 : Type"Standard" random number generator.