$std::prng
This module uses a 64bit Mersenne Twister to generate pseudorandom numbers.
The output of the generator is completely deterministic and depends only on the initial seed value, i.e. the sequence of numbers generated will always be identical for a given seed.
The generator is automatically initialized at startup using a random seed but you can reinitialize the generator at any time by calling seed(arg)
. This reseeds the generator using the argument's 64bit hash value.
Functions

rand_float() > f64

Returns a uniformlydistributed random float from the halfopen interval
[0, 1)
, i.e. the interval from zero up to but not including 1. The generator produces floats with 53 bits of precision. 
rand_int(n: i64) > i64

Returns a uniformlydistributed random integer from the halfopen interval
[0, n)
, i.e. the interval from zero up to but not includingn
, wheren
is a positive integer. 
rand_int_in_range(lower: i64, upper: i64) > i64

Returns a uniformlydistributed random integer from the halfopen interval
[lower, upper)
, i.e. the interval fromlower
up to but not includingupper
.The arguments can be positive or negative or mixed as long as
lower
is less than or equal toupper
. 
seed(arg: any)

Seeds (or reseeds) the generator using the argument's 64bit hash value. This is an alias for
seed_with_hash()
. 
seed_with_array(arg: bufstr)

Seeds (or reseeds) the generator using the content of a string or buffer, treated as an array of bytes. Uses up to the first 2,496 bytes of content.
If
arg
contains less than 8 bytes of content, this is equivalent to callingseed_with_hash()
. 
seed_with_hash(arg: any)

Seeds (or reseeds) the generator using the argument's 64bit hash value.