Creates a new seeded random number generator.
The seed should be a 256-bit value, represented as an array of 4 64-bit integers (as bigints). For the output distribution to look random, the seed should not have any obvious patterns, like all zeroes or all ones.
This is not cryptographically secure, and should only be used for testing purposes.
Array of 4 64-bit unsigned integers as bigints
StaticfromCreates a new seeded random number generator from a seed array. Convenience method that accepts numbers and converts to bigints.
Array of 4 64-bit unsigned integers
Returns the next random 64-bit unsigned integer as a bigint.
Returns the next random 32-bit unsigned integer.
Fills the given Uint8Array with random bytes.
Note: This implementation matches the Rust behavior exactly - it uses one nextU64() call per byte (taking only the low byte), which matches the Swift version's behavior.
Returns a Uint8Array of random bytes of the given size.
This might not be the most efficient implementation, but it works the same as the Swift version.
Fills the given Uint8Array with random bytes.
A random number generator that can be used as a source of deterministic pseudo-randomness for testing purposes.
Uses the Xoshiro256** algorithm, which is the same algorithm used by rand_xoshiro in Rust. This ensures cross-platform compatibility with the Rust implementation.
WARNING: This is NOT cryptographically secure and should only be used for testing purposes.