Basic random number generator support based on the one available on the Haskell library
range
returns the range of values returned by the 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).
Interface for random number generators.
Instances
Equations
- instInhabitedStdGen = { default := { s1 := 0, s2 := 0 } }
Equations
- One or more equations did not get rendered due to their size.
Equations
- instRandomGenStdGen = { range := fun x => stdRange, next := stdNext, split := stdSplit }
Equations
Instances For
Equations
- IO.rand lo hi = do let gen ← ST.Ref.get IO.stdGenRef match randNat gen lo hi with | (r, gen) => do ST.Ref.set IO.stdGenRef gen pure r