A library for working with phylogenetic and population genetic data.
v0.32.0
random.cpp File Reference
#include "genesis/utils/math/random.hpp"
#include "genesis/utils/core/options.hpp"
#include <cassert>
#include <random>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

static uint32_t pcg32_rotr32 (uint32_t x, unsigned int r)
 
uint32_t permuted_congruential_generator ()
 Fast random number generator for 32bit integers. More...
 
uint32_t permuted_congruential_generator (uint32_t max)
 Fast random number generator for 32bit integers, for numbers in the range [0, max]. More...
 
uint32_t permuted_congruential_generator (uint32_t min, uint32_t max)
 Fast random number generator for 32bit integers, for numbers in the range [min, max]. More...
 
bool permuted_congruential_generator_bool ()
 Fast random number generator for 32bit integers, for bool with 0.5 probability. More...
 
bool permuted_congruential_generator_bool (uint32_t chance_one_in)
 Fast random number generator for 32bit integers, for bool with a given chance. More...
 
void permuted_congruential_generator_init (uint64_t seed)
 Set the seed for permuted_congruential_generator(). More...
 
std::vector< size_t > select_without_replacement (size_t k, size_t n)
 Select k many unique numbers out of the range [ 0, n ). More...
 

Variables

static const uint64_t pcg32_increment = 1442695040888963407u
 
static const uint64_t pcg32_multiplier = 6364136223846793005u
 
static uint64_t pcg32_state = 0x4d595df4d0f33173