Random¶
Import: import system;
Random¶
Seedable xorshift32 PRNG.
constructor¶
Creates a generator from seed (0 is remapped to 1 so the state is never zero).
next_u32¶
Advances the generator and returns the next 32-bit value.
next_int¶
Uniform integer in [0, bound) when bound > 0, otherwise 0.
next_double¶
Uniform value in [0.0, 1.0) at full 32-bit resolution (no quantization or modulo bias).
next_bool¶
True or false with equal probability.
next_long¶
Uniform 64-bit value from two independent 32-bit draws, composed exactly (may be negative when viewed as signed).
next_bytes¶
Generates n pseudorandom bytes; negative lengths produce an empty array.
choice¶
Selects a uniformly bounded index from list, or returns None for an empty list.
shuffle¶
Permutes list in place using Fisher-Yates swaps and unbiased bounded indices.