klee
RNG.h
Go to the documentation of this file.
1//===-- RNG.h ---------------------------------------------------*- C++ -*-===//
2//
3// The KLEE Symbolic Virtual Machine
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef KLEE_RNG_H
11#define KLEE_RNG_H
12
13namespace klee {
14 class RNG {
15 private:
16 /* Period parameters */
17 static const int N = 624;
18 static const int M = 397;
19 static const unsigned int MATRIX_A = 0x9908b0dfUL; /* constant vector a */
20 static const unsigned int UPPER_MASK = 0x80000000UL; /* most significant w-r bits */
21 static const unsigned int LOWER_MASK = 0x7fffffffUL; /* least significant r bits */
22
23 private:
24 unsigned int mt[N]; /* the array for the state vector */
25 int mti;
26
27 public:
28 RNG();
29 explicit RNG(unsigned int seed);
30
31 /* set seed value */
32 void seed(unsigned int seed);
33
34 /* generates a random number on [0,0xffffffff]-interval */
35 unsigned int getInt32();
36 /* generates a random number on [0,0x7fffffff]-interval */
37 int getInt31();
38 /* generates a random number on [0,1]-real-interval */
39 double getDoubleLR();
40 float getFloatLR();
41 /* generates a random number on [0,1)-real-interval */
42 double getDoubleL();
43 float getFloatL();
44 /* generates a random number on (0,1)-real-interval */
45 double getDouble();
46 float getFloat();
47 /* generators a random flop */
48 bool getBool();
49 };
50}
51
52#endif /* KLEE_RNG_H */
Definition: RNG.h:14
RNG()
Definition: RNG.cpp:58
double getDoubleL()
Definition: RNG.cpp:127
double getDouble()
Definition: RNG.cpp:133
static const unsigned int LOWER_MASK
Definition: RNG.h:21
unsigned int getInt32()
Definition: RNG.cpp:82
void seed(unsigned int seed)
Definition: RNG.cpp:67
int mti
Definition: RNG.h:25
static const unsigned int UPPER_MASK
Definition: RNG.h:20
static const int N
Definition: RNG.h:17
float getFloatL()
Definition: RNG.cpp:142
double getDoubleLR()
Definition: RNG.cpp:121
static const int M
Definition: RNG.h:18
unsigned int mt[N]
Definition: RNG.h:24
int getInt31()
Definition: RNG.cpp:116
float getFloatLR()
Definition: RNG.cpp:138
float getFloat()
Definition: RNG.cpp:146
bool getBool()
Definition: RNG.cpp:151
static const unsigned int MATRIX_A
Definition: RNG.h:19
Definition: main.cpp:291