Documentation

Init.Data.Random

class RandomGen (g : Type u) :
Type u
Instances
structure StdGen:
Type
Equations
Equations
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations

Return a standard number generator.

Equations
  • mkStdGen s = let q := s / 2147483562; let s1 := s % 2147483562; let s2 := q % 2147483398; { s1 := s1 + 1, s2 := s2 + 1 }
def randNat {gen : Type u} [inst : RandomGen gen] (g : gen) (lo : Nat) (hi : Nat) :
Nat × gen

Generate a random natural number in the interval [lo, hi].

Equations
  • One or more equations did not get rendered due to their size.
def randBool {gen : Type u} [inst : RandomGen gen] (g : gen) :
Bool × gen

Generate a random Boolean.

Equations
def IO.rand (lo : Nat) (hi : Nat) :
Equations