Generate a random Boolean.
8.9.Β Random Numbers
def
randNat.{u} {gen : Type u} [RandomGen gen] (g : gen) (lo hi : Nat) : Nat Γ gen
Generate a random natural number in the interval [lo, hi].
8.9.1.Β Random Generators
type class
RandomGen.{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).
structure
StdGen : Type