-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom.h
26 lines (18 loc) · 885 Bytes
/
random.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef _RANDOM_H
#define _RANDOM_H_
#include <boost/random.hpp>
#include <ctime>
#include <cmath>
#include <vector>
//static boost::mt19937 generator(static_cast<unsigned> (std::time(0)));
// return a random number between 0-1
double random_uni01();
// return a random number between lowest(including) and highest(excluding)
unsigned int get_a_random_number(int lowest, int highest);
// return a random number between lowest(including) and highest(excluding) using boost
unsigned int boost_get_a_random_number(int lowest, int highest);
// return a random number with discrete prob.; pass the cum. distribution vector
unsigned int randomWithDiscreteProbability(const std::vector<double>& accum_prob_vec);
// return a random number with discrete prob.; pass the cum. distribution vector
unsigned int randomWithDiscreteProbability(const std::vector<int>& accum_prob_vec);
#endif