Random
eff Random
SourceAn effect used to generate random numbers.
Operations
def randomBool(): Bool
SourceReturns a pseudorandom boolean value with equal probability of being true
or false
.
def randomFloat32(): Float32
SourceReturns a pseudorandom 32-bit floating-point number in the range [0.0, 1.0].
def randomFloat64(): Float64
SourceReturns a pseudorandom 64-bit floating-point number in the range [0.0, 1.0].
def randomGaussian(): Float64
SourceReturns a 64-bit floating point number following a standard normal (Gaussian) distribution.
def randomInt32(): Int32
SourceReturns a pseudorandom 32-bit integer.
def randomInt64(): Int64
SourceReturns a pseudorandom 64-bit integer.
Definitions
def handle(f: a -> b \ ef): a -> b \ (ef - Random) + NonDet + IO
SourceHandles the Random
effect of the given function f
.
In other words, re-interprets the Random
effect using the NonDet
and IO
effects.
def handleWithSeed(seed: Int64, f: a -> b \ ef): a -> b \ ef - Random
SourceRuns the Random
effect of the given function f
from an initial seed.
In other words, re-interprets the Random
effect using seeded deterministic randomness.
def runWithIO(f: Unit -> a \ ef): a \ (ef - Random) + NonDet + IO
SourceRuns the Random
effect of the given function f
.
In other words, re-interprets the Random
effect using the NonDet
and IO
effects.
def runWithSeed(seed: Int64, f: Unit -> a \ ef): a \ ef - Random
SourceRuns the Random
effect of the given function f
from an initial seed.
In other words, re-interprets the Random
effect using seeded deterministic randomness.