compiler/shared/l0/stdlib/std/rand.l0
Module std.rand
Overview Symbols grouped by source file: compiler/shared/l0/stdlib/std/rand.l0
Module: std.rand
Source: compiler/shared/l0/stdlib/std/rand.l0 Language: Dea/L0
Imports / Includes
sys.rt
Symbols
Function rand_seed
func rand_seed(seed : int) -> void
Seeds the random number generator with the given seed.
A non-zero seed produces a reproducible sequence of numbers for the same seed. 0 means use the current time as the seed (not reproducible sequence of numbers).
Parameters:
seed: The integer seed value.
Function rand_int
func rand_int(max : int) -> int
Returns a random integer in the range [0, max).
Parameters:
max: The upper bound (exclusive).
Returns: A random integer.
Function rand_int_range
func rand_int_range(min : int, max : int) -> int
Returns a random integer in the range [min, max).
Parameters:
min: The lower bound (inclusive).max: The upper bound (exclusive).
Returns: A random integer.
Function rand_bool
func rand_bool() -> bool
Returns a random boolean value.
Returns: A random boolean.
Function rand_dice
func rand_dice(sides : int, rolls : int) -> int
Rolls the specified number of dice with the given number of sides and returns the total.
Parameters:
sides: The number of sides on each die.rolls: The number of dice to roll.
Returns: The total sum of the rolls.