Empirical
Namespaces | Functions
random_utils.h File Reference

Helper functions for emp::Random for common random tasks. More...

#include "../base/vector.h"
#include "BitVector.h"
#include "Random.h"

Go to the source code of this file.

Namespaces

 emp
 If we are in emscripten, make sure to include the header.
 

Functions

template<typename T >
void emp::Shuffle (Random &random, emp::vector< T > &v, size_t max_count)
 
template<typename T >
void emp::Shuffle (Random &random, emp::vector< T > &v)
 
emp::vector< size_t > emp::GetPermutation (Random &random, size_t size)
 Return an emp::vector<int> numbered 0 through size-1 in a random order. More...
 
void emp::Choose (Random &random, size_t N, size_t K, std::vector< size_t > &choices)
 Choose K positions from N possibilities. More...
 
std::vector< size_t > emp::Choose (Random &random, size_t N, size_t K)
 
BitVector emp::RandomBitVector (Random &random, size_t size, double p=0.5)
 Generate a random BitVector of the specified size. More...
 
emp::vector< double > emp::RandomDoubleVector (Random &random, size_t size, double min, double max)
 Generate a random double vector in the specified range. More...
 
emp::vector< size_t > emp::RandomUIntVector (Random &random, size_t size, size_t min, size_t max)
 Generate a random size_t vector in the specified range. More...
 
template<typename T >
emp::vector< T > emp::RandomVector (Random &random, size_t size, T min, T max)
 Generate a random vector in the specified type and range. More...
 
void emp::RandomizeBitVector (BitVector &bits, Random &random, double p=0.5)
 Generate a random BitVector of the specified size. More...
 
template<typename T >
void emp::RandomizeVector (emp::vector< T > &vals, Random &random, T min, T max)
 Generate a random vector in the specified type and range. More...
 

Detailed Description

Helper functions for emp::Random for common random tasks.

Note
This file is part of Empirical, https://github.com/devosoft/Empirical
Date
2016-2017
Note
Status: RELEASE