PRNG family

xoshiro / xoroshiro

Fast linear generators from Blackman and Vigna for simulation, not for secrets

unverified 14 variants Blackman and Vigna, Scrambled Linear Pseudorandom Number Generators

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–2018
  1. xoshiro / xoroshiro published by David Blackman, Sebastiano Vigna

How it works

  1. Seed the state with nonzero values, typically from SplitMix64.
  2. Compute the output by applying the scrambler (+, ++, * or **) to one or more state words.
  3. Advance the state with a fixed sequence of xors, shifts and rotations.
  4. 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

Monte Carlo simulationProcedural generation and gamesRandomised algorithms and testing

Variants in NextSSL

14
AlgorithmTierSizes (bytes)StandardsAPI
Xoroshiro128+
xoroshiro128-plus
unverified out 1–268435456 · seed 16 xoroshiro128+ (Blackman, Vigna 2016), low bits are weak… root
Xoroshiro128-Plusplus
xoroshiro128-plusplus
unverified out 1–268435456 · seed 16 xoroshiro128++ (Blackman, Vigna 2018), NOT cryptographi… root
Xoroshiro128-Starstar
xoroshiro128-starstar
unverified out 1–268435456 · seed 16 xoroshiro128** (Blackman, Vigna 2018), NOT cryptographi… root
Xoroshiro64-Star
xoroshiro64-star
unverified out 1–268435456 · seed 8 xoroshiro64* (Blackman, Vigna 2018), NOT cryptographica… root
Xoroshiro64-Starstar
xoroshiro64-starstar
unverified out 1–268435456 · seed 8 xoroshiro64** (Blackman, Vigna 2018), NOT cryptographic… root
Xoshiro128+
xoshiro128-plus
unverified out 1–268435456 · seed 16 xoshiro128+ (Blackman, Vigna 2018), low bits are weak, … root
Xoshiro128-Plusplus
xoshiro128-plusplus
unverified out 1–268435456 · seed 16 xoshiro128++ (Blackman, Vigna 2018), NOT cryptographica… root
Xoshiro128-Starstar
xoshiro128-starstar
unverified out 1–268435456 · seed 16 xoshiro128** (Blackman, Vigna 2018), NOT cryptographica… root
Xoshiro256+
xoshiro256-plus
unverified out 1–268435456 · seed 32 xoshiro256+ (Blackman, Vigna 2018), low bits are weak, … root
Xoshiro256-Plusplus
xoshiro256-plusplus
unverified out 1–268435456 · seed 32 xoshiro256++ (Blackman, Vigna 2018), NOT cryptographica… root
Xoshiro256-Starstar
xoshiro256-starstar
unverified out 1–268435456 · seed 32 xoshiro256** (Blackman, Vigna 2018), NOT cryptographica… root
Xoshiro512+
xoshiro512-plus
unverified out 1–268435456 · seed 64 xoshiro512+ (Blackman, Vigna 2018), low bits are weak, … root
Xoshiro512-Plusplus
xoshiro512-plusplus
unverified out 1–268435456 · seed 64 xoshiro512++ (Blackman, Vigna 2018), NOT cryptographica… root
Xoshiro512-Starstar
xoshiro512-starstar
unverified out 1–268435456 · seed 64 xoshiro512** (Blackman, Vigna 2018), NOT cryptographica… root

Frequently asked questions

Which xoshiro / xoroshiro variants does NextSSL include?

NextSSL registers 14 xoshiro / xoroshiro variants: xoroshiro128-plus, xoroshiro128-plusplus, xoroshiro128-starstar, xoroshiro64-star, xoroshiro64-starstar, xoshiro128-plus, xoshiro128-plusplus, xoshiro128-starstar, xoshiro256-plus, xoshiro256-plusplus and more.