Xoroshiro128-Starstar
Fast linear generators from Blackman and Vigna for simulation, not for secrets
Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About Xoroshiro128-Starstar
Xoroshiro128-Starstar is one of 14 xoshiro / xoroshiro variants in the NextSSL registry, a non-cryptographic pseudorandom generator. It uses a 1–268,435,456-byte output and a 16-byte seed. Its registry entry cites xoroshiro128** (Blackman, Vigna 2018), NOT cryptographically secure. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
The xoshiro and xoroshiro generators are small, very fast pseudorandom number generators based on xor, shift and rotate operations on a linear state, followed by a nonlinear scrambler. They are popular defaults for simulations and games but must never be used for keys, nonces or tokens.
Each generator updates a 64- to 512-bit state with a linear transformation over GF(2), which guarantees a long, well-understood period, and then applies a scrambler to produce output. The scrambler name is part of the variant: + adds two state words, ++ adds, rotates and adds again, * multiplies by a constant and ** multiplies, rotates and multiplies. The + variants have weak low-order bits and are intended for generating floating-point numbers, where those bits are discarded.
xoroshiro uses two state words (64 or 128 bits of state), while xoshiro uses four or eight (128, 256 or 512 bits). The authors recommend xoshiro256** or xoshiro256++ for general-purpose use. These generators are the defaults in several language runtimes, including .NET and Lua. Fourteen variants are present: xoroshiro64* and xoroshiro64**, xoroshiro128 with +, ++ and **, and xoshiro128, xoshiro256 and xoshiro512, each with +, ++ and **.
History
2018–2018xoshiro / xoroshiro published by David Blackman, Sebastiano Vigna
How it works
- Seed the state with nonzero values, typically from SplitMix64.
- Compute the output by applying the scrambler (+, ++, * or **) to one or more state words.
- Advance the state with a fixed sequence of xors, shifts and rotations.
- Use jump functions to split one stream into non-overlapping subsequences for parallel work.
Security notes
Not cryptographically secure: the state is linear and can be recovered from a small number of outputs, after which all future and past outputs are predictable. Use the OS RNG or a DRBG for anything security-related. The + variants also have statistically weak low bits.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 1 – 268,435,456 | Output |
| seed | 16 | Seed |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
buf = root.call("rng_fill", "xoroshiro128-starstar", "seed=42", 32)[0] # not for keys
nextssl_root_rng_fill("xoroshiro128-starstar", "seed=42", 32, out);
// prng is a root-only kind: use the C ABI (nextssl_root_*)
// or the Prng trait in nextssl-core/src/traits.rs
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other xoshiro / xoroshiro variants
13More non-cryptographic prngs
All 26Frequently asked questions
What is Xoroshiro128-Starstar?
Xoroshiro128-Starstar is a PRNG in the xoshiro / xoroshiro family. The xoshiro and xoroshiro generators are small, very fast pseudorandom number generators based on xor, shift and rotate operations on a linear state, followed by a nonlinear scrambler.
What are the Xoroshiro128-Starstar sizes?
In NextSSL, Xoroshiro128-Starstar uses: output 1 to 268,435,456 bytes.
Who designed Xoroshiro128-Starstar and when?
Xoroshiro128-Starstar belongs to the xoshiro / xoroshiro family, first published in 2018 by David Blackman, Sebastiano Vigna. Its origin: Blackman and Vigna, Scrambled Linear Pseudorandom Number Generators.
Which standards define Xoroshiro128-Starstar?
Xoroshiro128-Starstar is referenced by xoroshiro128** (Blackman, Vigna 2018), NOT cryptographically secure.
Is Xoroshiro128-Starstar safe to use?
Xoroshiro128-Starstar is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other xoshiro / xoroshiro variants are there?
NextSSL also registers xoroshiro128-plus, xoroshiro128-plusplus, xoroshiro64-star, xoroshiro64-starstar, xoshiro128-plus, xoshiro128-plusplus and more in the xoshiro / xoroshiro family.
Related families
Permuted congruential generators: LCG state with a permutation on output
SplitMix64Counter-based 64-bit generator, widely used to seed other generators
Xorshift128Marsaglia's minimal xor-and-shift generator, ancestor of xoshiro
Operating system RNGThe kernel's cryptographically secure random number generator, the right default