Xoshiro256++
What it is
xoshiro256++ is Blackman & Vigna’s all-purpose 64-bit generator: a small,
extremely fast scrambled-linear engine with a period of
2256 − 1 that passes the full BigCrush / PractRand batteries. It is the
default simdrng::Xoshiro.
When to use it
Reach for xoshiro256++ as the general-purpose default — simulation, sampling, games, procedural generation — anywhere you want maximum throughput of high-quality 64-bit values and do not need cryptographic guarantees or stateless counter-based seeking (use Philox for the latter).
Scalar, SIMD dispatch, and native
Three implementations share one interface; pick by include and type:
Type |
Header |
Use when |
|---|---|---|
|
|
Portable, dependency-free, |
|
|
One binary, many CPUs: the SIMD tier is chosen at runtime via xsimd dispatch (AVX-512 / AVX2 / SSE2 / NEON / …). |
|
|
You build with |
simdrng::Xoshiro (from <simdrng/xoshiro.hpp>) aliases XoshiroSIMD
when built with xsimd, and XoshiroScalar otherwise.
#include <simdrng/xoshiro.hpp>
simdrng::Xoshiro rng(42); // seed (SplitMix64-expanded internally)
std::uint64_t x = rng(); // next 64-bit value
double u = rng.uniform(); // double in [0, 1)
The SIMD types refill an internal cache with wide batches, so an ordinary generate loop runs vectorised — there is no separate bulk-fill API.
Periods and streams
xoshiro256++ has a period of 2256 − 1. The seed is expanded through
SplitMix64 (see SplitMix64) so even low-entropy seeds give sound state. For
independent parallel streams, pass thread_id and cluster_id:
simdrng::Xoshiro rng(seed, thread_id, cluster_id);
Internally jump() carves out non-overlapping per-thread subsequences and
long_jump() per-cluster starting points. See Generator properties for the
exact jump spacing and the full period table.
References
xoshiro256++ and its SplitMix64 seeding follow D. Blackman and S. Vigna,
Scrambled Linear Pseudorandom Number Generators (the design and the ++
scrambler) and S. Vigna’s https://prng.di.unimi.it/ (seeding and the shootout).
See References.