[go: up one dir, main page]

Menu

[49ee99]: / OptFrame / RandGen.hpp  Maximize  Restore  History

Download this file

40 lines (32 with data), 485 Bytes

 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
37
38
39
#ifndef RANDGEN_HPP_
#define RANDGEN_HPP_
// reuse of function 'rand()' by using function 'randgen_sys_rand()'
int randgen_sys_rand()
{
return rand();
}
class RandGen
{
protected:
int seed;
public:
RandGen()
{
srand(time(NULL));
}
RandGen(int _seed) :
seed(_seed)
{
srand(seed);
}
int rand()
{
// reuse of function 'rand()' by using function 'randgen_sys_rand()'
return randgen_sys_rand();
}
int getSeed()
{
return seed;
}
};
#endif /* RANDGEN_HPP_ */