Random

GitHub   Edit on GitHub

System access to random values.

1
import Random from "sys/random"

Values

Functions and constants included in the Random module.

Random.randomInt32

Added in 0.5.0 No other changes yet.
1
randomInt32 : () -> Result<Int32, Exception>

Produce a random 32-bit integer. This function can be slow, so it’s best to seed a generator if lots of random data is needed.

Returns:

type description
Result<Int32, Exception> Ok(num) of a random Int32 if successful or Err(exception) otherwise

Random.randomInt64

Added in 0.5.0 No other changes yet.
1
randomInt64 : () -> Result<Int64, Exception>

Produce a random 64-bit integer. This function can be slow, so it’s best to seed a generator if lots of random data is needed.

Returns:

type description
Result<Int64, Exception> Ok(num) of a random Int64 if successful or Err(exception) otherwise

Random.random

1
random : () -> Result<Number, Exception>

Produce a random number. This function can be slow, so it’s best to seed a generator if lots of random data is needed.

Returns:

type description
Result<Number, Exception> Ok(num) of a random number if successful or Err(exception) otherwise
This is a notification!