ODT
Loading...
Searching...
No Matches
source
randomGenerator.h
Go to the documentation of this file.
1
7
8
#pragma once
9
10
#include "
MersenneTwister.h
"
11
#include "
processor.h
"
12
17
//
18
19
extern
processor
proc
;
20
21
class
randomGenerator
{
22
23
private :
24
25
MTRand
mtwist
;
26
27
public :
28
29
inline
double
getRand
() {
30
return
mtwist
.
rand
();
31
}
32
inline
int
getRandInt
(
unsigned
n) {
33
return
mtwist
.
randInt
(n);
34
}
35
36
randomGenerator
(
const
int
aseed) :
mtwist
(
proc
.myid + aseed) {
37
//randomGenerator(const int aseed) : mtwist(aseed) {
38
if
(aseed < 0)
// randomize the seed
39
mtwist
.
seed
();
40
}
41
randomGenerator
() :
mtwist
() {}
42
};
43
44
45
MersenneTwister.h
MTRand
Definition
MersenneTwister.h:71
MTRand::seed
void seed(const uint32 oneSeed)
Definition
MersenneTwister.h:217
MTRand::rand
double rand()
Definition
MersenneTwister.h:148
MTRand::randInt
uint32 randInt()
Definition
MersenneTwister.h:181
processor
Definition
processor.h:22
randomGenerator
Definition
randomGenerator.h:21
randomGenerator::getRand
double getRand()
Definition
randomGenerator.h:29
randomGenerator::getRandInt
int getRandInt(unsigned n)
Definition
randomGenerator.h:32
randomGenerator::mtwist
MTRand mtwist
Mersenne twister object.
Definition
randomGenerator.h:25
randomGenerator::randomGenerator
randomGenerator()
Definition
randomGenerator.h:41
randomGenerator::randomGenerator
randomGenerator(const int aseed)
Definition
randomGenerator.h:36
processor.h
Header file for class processor.
proc
processor proc
Definition
main.cc:28
Generated by
1.10.0