These methods create reproducible sequences of random numbers given an initial seed value.
This methods rely on the pure-rand project.
Generates random numbers using the Mersenne Twister generator whose values are within the range 0 to 0xffffffff.
{% tabs %} {% tab title="Usage" %}
const SEED = 5
const sequence: Seq<number> = random(SEED)
{% endtab %}
{% tab title="Type Definition" %}
type random = (seed = DEFAULT_SEED) => Seq<number>
{% endtab %} {% endtabs %}
Generates random numbers using the Mersenne Twister generator whose values are within the range 0 to 0xffffffff.
{% tabs %} {% tab title="Usage" %}
const SEED = 5
const sequence: Seq<number> = mersenne(SEED)
{% endtab %}
{% tab title="Type Definition" %}
type mersenne = (seed = DEFAULT_SEED) => Seq<number>
{% endtab %} {% endtabs %}
Generates random numbers using the xorshift128+ generator whose values are within the range -0x80000000 to 0x7fffffff.
{% tabs %} {% tab title="Usage" %}
const SEED = 5
const sequence: Seq<number> = xorshift128plus(SEED)
{% endtab %}
{% tab title="Type Definition" %}
type xorshift128plus = (seed = DEFAULT_SEED) => Seq<number>
{% endtab %} {% endtabs %}
Generates random numbers using the xoroshiro128+ generator whose values are within the range -0x80000000 to 0x7fffffff.
{% tabs %} {% tab title="Usage" %}
const SEED = 5
const sequence: Seq<number> = xoroshiro128plus(SEED)
{% endtab %}
{% tab title="Type Definition" %}
type xoroshiro128plus = (seed = DEFAULT_SEED) => Seq<number>
{% endtab %} {% endtabs %}
Generates random numbers using a Linear Congruential generator whose values are within the range 0 to 0x7fff.
{% tabs %} {% tab title="Usage" %}
const SEED = 5
const sequence: Seq<number> = congruential(SEED)
{% endtab %}
{% tab title="Type Definition" %}
type congruential = (seed = DEFAULT_SEED) => Seq<number>
{% endtab %} {% endtabs %}
Generates random numbers using a Linear Congruential generator whose values are within the range 0 to 0xffffffff.
{% tabs %} {% tab title="Usage" %}
const SEED = 5
const sequence: Seq<number> = congruential32(SEED)
{% endtab %}
{% tab title="Type Definition" %}
type congruential32 = (seed = DEFAULT_SEED) => Seq<number>
{% endtab %} {% endtabs %}