ESC
No recent searches
Search by
Standard Library  /  Random

Random

System access to random values.

Edit on GitHub
from "wasi/random" include Random

Values

Functions and constants included in the Random module.

Random.randomUint32

Added in 0.6.0
versionchanges
0.5.0Originally named `randomInt32`
randomUint32 : () => Result<Uint32, 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:

Result<Uint32, Exception>: Ok(num) of a random Uint32 if successful or Err(exception) otherwise

Random.randomUint64

Added in 0.6.0
versionchanges
0.5.0Originally named `randomInt64`
randomUint64 : () => Result<Uint64, 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:

Result<Uint64, Exception>: Ok(num) of a random Uint64 if successful or Err(exception) otherwise

Random.random

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:

Result<Number, Exception>: Ok(num) of a random number if successful or Err(exception) otherwise

Sign up for farm-to-inbox developer news

You can unsubscribe at any time. Read our privacy policy.

Copyright © 2024 The Grain Programming Language