randomBytes asks the host for cryptographically secure bytes, and is what a key, a nonce, or a token wants. A Xoshiro128 is the opposite: an independent xoshiro128** sequence with nothing hidden in it, so the same seed always draws the same numbers. Omitting the seed picks a fixed one rather than reading a clock. Request a seed explicitly when a sequence must vary between runs.
A seed is one 32-bit word. A generator is mutable and is not safe to share between workers; give each lane its own.
state and setState copy the four signed 32-bit state words. That is the portable checkpoint format: keep them and the next draw is exactly the one that was coming.
Returns an integer in [1, m], or in [m, n] when both are given.
A range of up to 2^32 values takes one draw, so seeded sequences over small ranges stay what they were. A wider one takes 53 bits from two draws and rejects the uneven tail, so every value in it can come up.
Arguments
Name
Type
Description
self
any
m
integer
n
integer?
Returns
Type
Description
integer
Raises
Type
Condition
string
when the selected range is empty, when a bound is not a finite integer, or when the range holds more than 2^53 values