baml.random.Xoshiro256PlusPlus
A fast, seedable, deterministic PRNG (xoshiro256++). Given the same seed it always reproduces the same stream, which makes it ideal for tests, simulations, and sampling.
Signature
class baml.random.Xoshiro256PlusPlusA fast, seedable, deterministic PRNG (xoshiro256++). Given the same seed it always reproduces the same stream, which makes it ideal for tests, simulations, and sampling.
NOT cryptographically secure: its output is predictable from observed draws.
Never use it for keys, tokens, nonces, or any security-sensitive value — use
SystemRandom or a well-seeded ChaCha20 instead.
Source:<builtin>/baml/ns_random/random.bamlbytes 2766–4117
Fields
_state
$rust_typeOpaque, mutex-guarded generator state owned by the Rust runtime.
Static methods
_new
(seed: uint8array) -> baml.random.Xoshiro256PlusPlus throws nevernew
(seed: uint8array = …) -> baml.random.Xoshiro256PlusPlus throws neverCreates a new Xoshiro256PlusPlus pseudo-random number generator.
Parameters
seed: The seed for the random number generator. If no seed is provided, a random seed is generated using the system random number generator. The seed must be at least 32 bytes long.
Panics
If seed is shorter than 32 bytes.
Implementations
baml.Concrete for T
Source:<builtin>/baml/core.bamlbytes 763–795
baml.random.Rng for baml.random.Xoshiro256PlusPlus
Instance methods
random
(self, bytes: int) -> uint8array throws neverrandom_int
(self) -> int throws neverSource:<builtin>/baml/ns_random/random.bamlbytes 3832–4115