Theoretica
A C++ numerical and automatic mathematical library
pseudorandom.h File Reference

Pseudorandom number generation algorithms. More...

#include <vector>
#include <cstdint>
#include "../core/bit_op.h"
#include "../core/error.h"

Go to the source code of this file.

Namespaces

 theoretica
 Main namespace of the library which contains all functions and objects.
 

Typedefs

using theoretica::pseudorandom_function = uint64_t(*)(uint64_t, std::vector< uint64_t > &)
 A function pointer which wraps a pseudorandom generator, taking as input the previous generated value (or seed) and the current state of the algorithm. More...
 

Functions

uint64_t theoretica::rand_congruential (uint64_t x, uint64_t a=48271, uint64_t c=0, uint64_t m=((uint64_t) 1<< 31) - 1)
 Generate a pseudorandom number using the congruential pseudorandom number generation algorithm. More...
 
uint64_t theoretica::rand_congruential (uint64_t x, std::vector< uint64_t > &state)
 Generate a pseudorandom number using the congruential pseudorandom number generation algorithm (wrapper) More...
 
uint64_t theoretica::rand_xoshiro (uint64_t &a, uint64_t &b, uint64_t &c, uint64_t &d)
 Generate a pseudorandom number using the xoshiro256++ pseudorandom number generation algorithm. More...
 
uint64_t theoretica::rand_xoshiro (uint64_t x, std::vector< uint64_t > &state)
 Generate a pseudorandom number using the xoshiro256++ pseudorandom number generation algorithm (wrapper) More...
 
uint64_t theoretica::rand_splitmix64 (uint64_t x)
 Generate a pseudorandom number using the SplitMix64 pseudorandom number generation algorithm. More...
 
uint64_t theoretica::rand_splitmix64 (uint64_t x, std::vector< uint64_t > &p)
 Generate a pseudorandom number using the SplitMix64 pseudorandom number generation algorithm. More...
 
uint64_t theoretica::rand_wyrand (uint64_t &seed, uint64_t p1, uint64_t p2)
 Generate a pseudorandom number using the Wyrand pseudorandom number generation, as invented by Yi Wang. More...
 
uint64_t theoretica::rand_wyrand (uint64_t x, std::vector< uint64_t > &p)
 Generate a pseudorandom number using the Wyrand pseudorandom number generation, as invented by Yi Wang (wrapper) More...
 
uint64_t theoretica::rand_middlesquare (uint64_t seed, uint64_t offset=765872292751861)
 Generate a pseudorandom number using the middle-square pseudorandom number generation algorithm. More...
 
uint64_t theoretica::rand_middlesquare (uint64_t x, std::vector< uint64_t > &p)
 Generate a pseudorandom number using the middle-square pseudorandom number generation algorithm (wrapper) More...
 

Detailed Description

Pseudorandom number generation algorithms.