The next random 32-bit unsigned integer.
The next random 64-bit unsigned integer, a bigint in [0, 2^64 - 1].
Fill dest with random bytes.
OptionalnextOptional fast path for the samplers: the low 32 bits of the value
nextU64() would have returned, advancing the generator exactly as
nextU64() does, without allocating a bigint. Implement it only when
that equality holds; the package's generators do.
OptionalfillFills dest from the generator's packed byte stream — rand_core's
fill_bytes layout (fill_bytes_via_next): eight little-endian bytes
per 64-bit draw, a tail of five to seven bytes from one more 64-bit draw,
a tail of one to four bytes from the next_u32 of the underlying
rand_core generator. For SeededRng that generator is
xoshiro256** behind the reference's wrapper, whose next_u32 is the
high half of one more step — not nextU32(), which is the wrapper's
low half. Only a generator whose fillBytes is a different stream needs
to implement it (SeededRng does: its fillBytes is the
reference's fill_random_data, one draw per byte); absent, the two
streams are the same and callers use fillBytes.
A source of random 32-bit words, 64-bit words and bytes.
nextU32andnextU64are two draws; which one a caller uses, and in what order, determines the bytes it produces. The samplers in/samplersdrawnextU64()(masked to their width), as the reference implementation does for every width. The package's own generators return the low half of one 64-bit step fromnextU32, as the reference's wrappers do; a third-party generator may relate the two draws however it likes.The contract is checked at every draw:
nextU64()must return abigintin[0, 2^64 - 1],nextU32()andnextU64Low32()an integer in[0, 2^32 - 1], and the member a helper or sampler calls must exist. A violation, or anundefined/nullgenerator passed straight to a sampler, throws RandErrorInvalidGeneratornaming the member; nothing is masked. A generator that meets the contract but never leaves Lemire's rejection zone (for example a constant draw of 0) makes a sampler loop forever, as it does in the reference.