Non-cryptographic PRNGs

Xoshiro512+

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

unverified Root API only Not cryptographic
Unverified tier.

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 Xoshiro512+

Xoshiro512+ 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 64-byte seed. Its registry entry cites xoshiro512+ (Blackman, Vigna 2018), low bits are weak, 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–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

Sizes

FieldBytesMeaning
out1 – 268,435,456Output
seed64Seed

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", "xoshiro512-plus", "seed=42", 32)[0]   # not for keys

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is Xoshiro512+?

Xoshiro512+ 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 Xoshiro512+ sizes?

In NextSSL, Xoshiro512+ uses: output 1 to 268,435,456 bytes.

Who designed Xoshiro512+ and when?

Xoshiro512+ 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 Xoshiro512+?

Xoshiro512+ is referenced by xoshiro512+ (Blackman, Vigna 2018), low bits are weak, NOT cryptographically secure.

Is Xoshiro512+ safe to use?

Xoshiro512+ 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, xoroshiro128-starstar, xoroshiro64-star, xoroshiro64-starstar, xoshiro128-plus and more in the xoshiro / xoroshiro family.