Random

enum RandomSource
case Random(java.util.Random)

Represents a random number generator.

Definitions

def choose(r: Random, a: Array[a, r]): Option[a] \ IO + r Source

Returns a pseudorandom element from the given array a using the random number generator r.

Returns None if the given array a is empty.

def new(_unit: Unit): Random \ IO Source

Returns a fresh random number generator.

def newWithSeed(s: Int64): Random \ IO Source

Returns a fresh random number generator initialized with the given seed s.

def nextBool(r: Random): Bool \ IO Source

Returns the next pseudorandom boolean from the given random number generator r.

def nextFloat32(r: Random): Float32 \ IO Source

Returns the next pseudorandom 32-bit floating point number from the given random number generator r.

def nextFloat64(r: Random): Float64 \ IO Source

Returns the next pseudorandom 64-bit floating point number from the given random number generator r.

def nextGaussian(r: Random): Float64 \ IO Source

Returns the next pseudorandom Gaussian distributed 64-bit floating point number.

def nextInt32(r: Random): Int32 \ IO Source

Returns the next pseudorandom 32-bit integer value from the given random number generator r.

def nextInt64(r: Random): Int64 \ IO Source

Returns the next pseudorandom 64-bit integer value from the given random number generator r.

def nextNatWithMax(r: Random, m: Int32): Int32 \ IO Source

Returns the next pseudorandom 32-bit integer value between 0 and m (exclusive) using the given random number generator r.