File: .lake/packages/lean4/src/lean/Init/Data/Random.lean

full_name: RandomGen.next
code: /-- Interface for random number generators. -/
class RandomGen (g : Type u) where
  /-- `range` returns the range of values returned by
      the generator. -/
  range : g → Nat × Nat
  /-- `next` operation returns a natural number that is uniformly distributed
      the range returned by `range` (including both end points),
     and a new generator. -/
  next  : g → Nat × 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). -/
  split : g → g × g
goal: g → Nat × g

full_name: RandomGen.split
code: /-- Interface for random number generators. -/
class RandomGen (g : Type u) where
  /-- `range` returns the range of values returned by
      the generator. -/
  range : g → Nat × Nat
  /-- `next` operation returns a natural number that is uniformly distributed
      the range returned by `range` (including both end points),
     and a new generator. -/
  next  : g → Nat × 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). -/
  split : g → g × g
goal: g → g × g

full_name: RandomGen
code: /-- Interface for random number generators. -/
class RandomGen (g : Type u) where
  /-- `range` returns the range of values returned by
      the generator. -/
  range : g → Nat × Nat
  /-- `next` operation returns a natural number that is uniformly distributed
      the range returned by `range` (including both end points),
     and a new generator. -/
  next  : g → Nat × 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). -/
  split : g → g × g
goal: Type u

full_name: RandomGen.range
code: /-- Interface for random number generators. -/
class RandomGen (g : Type u) where
  /-- `range` returns the range of values returned by
      the generator. -/
  range : g → Nat × Nat
  /-- `next` operation returns a natural number that is uniformly distributed
      the range returned by `range` (including both end points),
     and a new generator. -/
  next  : g → Nat × 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). -/
  split : g → g × g
goal: g → Nat × Nat

full_name: StdGen.s1
code: /-- "Standard" random number generator. -/
structure StdGen where
  s1 : Nat
  s2 : Nat
goal: Nat

full_name: StdGen
code: /-- "Standard" random number generator. -/
structure StdGen where
  s1 : Nat
  s2 : Nat
goal: Type

full_name: StdGen.s2
code: /-- "Standard" random number generator. -/
structure StdGen where
  s1 : Nat
  s2 : Nat
goal: Nat

full_name: instInhabitedStdGen
code: instance : Inhabited StdGen 
goal: Inhabited StdGen

full_name: stdRange
code: def stdRange 
goal: Nat × Nat

full_name: instReprStdGen
code: instance : Repr StdGen 
goal: Repr StdGen

full_name: stdNext
code: def stdNext : StdGen → Nat × StdGen
  
goal: StdGen → Nat × StdGen

full_name: stdSplit
code: def stdSplit : StdGen → StdGen × StdGen
  
goal: StdGen → StdGen × StdGen

full_name: instRandomGenStdGen
code: instance : RandomGen StdGen 
goal: RandomGen StdGen

full_name: mkStdGen
code: /-- Return a standard number generator. -/
def mkStdGen (s : Nat := 0) : StdGen 
goal: StdGen

full_name: _private.«.lake».packages.lean4.src.lean.Init.Data.Random.0.randNatAux
code: /--
Auxiliary function for randomNatVal.
Generate random values until we exceed the target magnitude.
`genLo` and `genMag` are the generator lower bound and magnitude.
The parameter `r` is the "remaining" magnitude.
-/
private partial def randNatAux {gen : Type u} [RandomGen gen] (genLo genMag : Nat) : Nat → (Nat × gen) → Nat × gen
  
goal: Nat → Nat × gen → Nat × gen

full_name: randNat
code: /-- Generate a random natural number in the interval [lo, hi]. -/
def randNat {gen : Type u} [RandomGen gen] (g : gen) (lo hi : Nat) : Nat × gen 
goal: Nat × gen

full_name: randBool
code: /-- Generate a random Boolean. -/
def randBool {gen : Type u} [RandomGen gen] (g : gen) : Bool × gen 
goal: Bool × gen

full_name: IO.stdGenRef
code: initialize IO.stdGenRef : IO.Ref StdGen ←
  let seed := UInt64.toNat (ByteArray.toUInt64LE! (← IO.getRandomBytes 8))
  IO.mkRef (mkStdGen seed)
goal: IO.Ref StdGen

full_name: initFn._@..lake.packages.lean4.src.lean.Init.Data.Random._hyg.764
code: initialize IO.stdGenRef : IO.Ref StdGen ←
  let seed := UInt64.toNat (ByteArray.toUInt64LE! (← IO.getRandomBytes 8))
  IO.mkRef (mkStdGen seed)
goal: IO (IO.Ref StdGen)

full_name: IO.setRandSeed
code: def IO.setRandSeed (n : Nat) : IO Unit 
goal: IO Unit

full_name: IO.rand
code: def IO.rand (lo hi : Nat) : IO Nat 
goal: IO Nat