aboutsummaryrefslogtreecommitdiff
path: root/CST 126/Homework 1/getrandom.hpp
blob: 8290d714c82754c859612de52da3ea74b24a657d (plain) (blame)
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
#ifndef GETRANDOM_H
#define GETRANDOM_H

#include <random>

using std::random_device;
using std::mt19937;
using std::uniform_int_distribution;


inline int GetRandom(const int upperbound, const int lowerbound)
{
    random_device rd;  // a seed source for the random number engine
    mt19937 gen(rd()); // mersenne_twister_engine seeded with rd()
    uniform_int_distribution<> distrib(lowerbound, upperbound);


    return distrib(gen);


}











#endif