Generate a random Boolean.
6.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].
6.9.1.Β Random Generators
type class
RandomGen.{u} (g : Type u) : Type u
Interface for random number generators.
Instance Constructor
RandomGen.mk.{u} {g : Type u}
(range : g β Nat Γ Nat) (next : g β Nat Γ g)
(split : g β g Γ g) : RandomGen g |
Methods
next | : | g β Nat Γ g |
| ||
range | : | g β Nat Γ Nat |
| ||
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