-
Notifications
You must be signed in to change notification settings - Fork 1
/
randomgenerator.h
28 lines (26 loc) · 1.16 KB
/
randomgenerator.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
#ifndef H_RANDOMGENERATOR
#define H_RANDOMGENERATOR
//--------------------------------------------------------------------------------------------------
#include <random>
#include <cstdlib>
#include <ctime>
//--------------------------------------------------------------------------------------------------
namespace randgen {
//--------------------------------------------------------------------------------------------------
inline void init()
{
srand(time(NULL));
}
//--------------------------------------------------------------------------------------------------
class CRandomGenerator
{
public:
static double ComputeRandomInInterval(const double left, const double right);
static int ComputeRandomInteger(int maxInt = RAND_MAX);
static bool ShuffleRepresentation(std::vector<int>& elements, int times = 1);
};
//--------------------------------------------------------------------------------------------------
};
//--------------------------------------------------------------------------------------------------
#endif // H_RANDOMGENERATOR
//--------------------------------------------------------------------------------------------------