Skip to content

Instantly share code, notes, and snippets.

@slwu89
Created December 13, 2017 03:03
Show Gist options
  • Save slwu89/92e391cc197c543de75b950de4f930ce to your computer and use it in GitHub Desktop.
Save slwu89/92e391cc197c543de75b950de4f930ce to your computer and use it in GitHub Desktop.
quick & dirty prng
#ifndef test_rng_hpp
#define test_rng_hpp
#include <random>
#include <stdio.h>
class rng_test {
public:
rng_test(const uint_least32_t &seed) : rng(seed) {
runif = std::uniform_real_distribution<double>(0,1);
};
~rng_test(){};
double get_runif(){
return runif(rng);
};
private:
std::mt19937 rng;
std::uniform_real_distribution<double> runif;
};
#endif /* test_rng_hpp */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment