-
Notifications
You must be signed in to change notification settings - Fork 0
/
Random.h
36 lines (29 loc) · 1013 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
27
28
29
30
31
32
33
34
35
36
//* Author: Dhiraj Amarnani, Hassan Naveed, Andre Koppert
//* Date: December 18 2017
#ifndef __random_h__
#define __random_h__
#include <random>
//*******************************************************************
//*
//* This header file declares and implements the methods and data
//* fields to be included in the Random class. The method
//* randdouble01 generates a pseudo-random number between a pre-
//* specified bound.
//*
//*******************************************************************
class Random
{
private:
static std::mt19937 rng;
static std::uniform_real_distribution<double> randdouble;
public:
inline static double randdouble01() { return Random::randdouble(Random::rng); }
//generates pseudo-random number between 0 and 1.
inline static double randdouble01(int a, int b)
{
double u = Random::randdouble(Random::rng);
double mappedValue = a + ((b - a )*u);
return(mappedValue);
}
};
#endif