package core.random
Random :: struct {
seed: i64
}
The state of a random number generator.
Methods
Random.between :: (self: &Random, lo: i32, hi: i32) -> i32
Generates a random 32-bit integer between lo
and hi
, inclusive.
Random.float :: (self: &Random, lo: f32, hi: f32) -> f32
Generates a random floating point number between lo
and hi
.
Random.make :: (seed: i64) -> Random
Creates a new random number generator.
An initial seed can be passed in, otherwise the current UNIX time is used.
Random.set_seed :: (self: &Random, s: u32) -> void
Random.set_seed :: (self: &Random, s: u64) -> void
between :: (lo: i32, hi: i32) -> i32
Generates a random integer, between lo
and hi
inclusively.
set_seed :: (s: u32) -> void
set_seed :: (s: u64) -> void
Sets the seed for the global random number generator.