SplitMix

class SplitMix64

The SplitMix is a fast splittable random number generator proposed by Guy L. Steele, Jr., Doug Lea, and Christine H. Flood. SplitMix is a counter-based generator that uses the MurmurHash3 finalizer as a mixing function. The main feature of the SplitMix is the ability to “split” a generator in two, i.e., generating two instances from one.

References:

[1] G. L. Steele, D. Lea, and C. H. Flood, “Fast splittable pseudorandom number generators”, in Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, in OOPSLA ’14. New York, NY, USA: Association for Computing Machinery, Oct. 2014, pp. 453–472. Doi: 10.1145/2660193.2660195.

[2] C++ implementation. Available: https://www.pcg-random.org/posts/some-prng-implementations.html

[3] Bug in SplitMix. Available: https://www.pcg-random.org/posts/bugs-in-splitmix.html

Public Functions

inline SplitMix64(state_type seed = default_seed, state_type stream = default_stream)

Creates a new instance of the SplitMix64 generator.

Parameters:
  • seed[in] generator seed

  • stream[in] generator increment

inline SplitMix64(const SplitMix64 &other)

Creates a new instance of the SplitMix64 generator from an other generator.

Parameters:

other[in] SplitMix64 generator to use as the data source

SplitMix64 &operator=(const SplitMix64 &other) = default

Copy the internal state and stream from other.

Parameters:

other[in] SplitMix64 generator to use as the data source

Returns:

*this

virtual ~SplitMix64() = default

Default destructor.

inline constexpr void seed(state_type seed = default_seed, state_type stream = default_stream)

Reseeds the generator.

Parameters:
  • seed[in] generator seed (optional)

  • stream[in] generator increment (optional)

inline constexpr uint64_t next()

Advances the generator state and generates a new pseudorandom 64-bits integer.

inline constexpr uint64_t operator()()

Advances the generator state and generates a new pseudorandom 64-bits integer.

inline SplitMix64 split()

“Splits” the generator, creating a new instance of SplitMix64 in the process.

Public Static Attributes

static constexpr short bytes = 8

The number of bytes generated.

static constexpr uint64_t max_val = UINT64_MAX

The largest possible value generated.

static constexpr uint64_t min_val = 0

The smallest possible value generated.