flix

0.58.0

Random

eff RandomSource

An effect used to generate random numbers.

Operations

def randomBool(): Bool Source

Returns a pseudorandom boolean value with equal probability of being true or false.

def randomFloat32(): Float32 Source

Returns a pseudorandom 32-bit floating-point number in the range [0.0, 1.0].

def randomFloat64(): Float64 Source

Returns a pseudorandom 64-bit floating-point number in the range [0.0, 1.0].

def randomGaussian(): Float64 Source

Returns a 64-bit floating point number following a standard normal (Gaussian) distribution.

def randomInt32(): Int32 Source

Returns a pseudorandom 32-bit integer.

def randomInt64(): Int64 Source

Returns a pseudorandom 64-bit integer.

Definitions

def handle(f: a -> b \ ef): a -> b \ (ef - Random) + NonDet + IO Source

Handles 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 Source

Runs 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 Source

Runs 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 Source

Runs the Random effect of the given function f from an initial seed.

In other words, re-interprets the Random effect using seeded deterministic randomness.