PRNG
Module: strata.utils • Kind: struct • Traits: Copyable, Movable
Source: strata/utils/random.mojo
struct PRNG(Copyable, Movable)from strata.utils import PRNG64-bit SplitMix64 pseudo-random number generator with unbiased range generation.
Constructors
Section titled “Constructors”def __init__(out self, seed: Int = 42)| Argument | Type | Description |
|---|---|---|
seed |
Int |
— |
Methods Overview
Section titled “Methods Overview”| Method | Description |
|---|---|
PRNG.next_u64() |
Generate the next 64-bit unsigned pseudo-random integer. |
PRNG.next_int() |
Returns a pseudo-random integer in [0, upper_bound). |
Method Details
Section titled “Method Details”PRNG.next_u64()
Section titled “PRNG.next_u64()”def next_u64(mut self) -> UInt64Generate the next 64-bit unsigned pseudo-random integer.
Returns: UInt64
PRNG.next_int()
Section titled “PRNG.next_int()”def next_int(mut self, upper_bound: Int) -> IntReturns a pseudo-random integer in [0, upper_bound).
| Parameter | Type | Description |
|---|---|---|
upper_bound |
Int |
— |
Returns: Int