Random
struct Random[rounds: Int = 10]
A high-performance random number generator using the Philox algorithm.
The Philox algorithm is a counter-based random number generator designed for parallel computing. It provides high-quality random numbers with excellent statistical properties and works efficiently on both CPU and GPU.
Parameters
- rounds (
Int): Number of mixing rounds to perform. Higher values provide better statistical quality at the cost of performance. Default is 10.
Implemented traits
AnyType,
Copyable,
ImplicitlyDestructible,
Movable
Methods
__init__
__init__(out self, *, seed: UInt64 = UInt64(0), subsequence: UInt64 = UInt64(0), offset: UInt64 = UInt64(0))
Initialize the random number generator.
Args:
step
step(mut self) -> SIMD[DType.uint32, 4]
Generate 4 random 32-bit unsigned integers.
Returns:
SIMD: SIMD vector containing 4 random 32-bit unsigned integers.
step_uniform
step_uniform(mut self) -> SIMD[DType.float32, 4]
Generate 4 random floating point numbers uniformly distributed in [0,1).
Returns:
SIMD: SIMD vector containing 4 random float32 values in range [0,1).