ROSE
0.9.6a
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
LinearCongruentialGenerator.h
Go to the documentation of this file.
1
#ifndef ROSE_LinearCongruentialGenerator_H
2
#define ROSE_LinearCongruentialGenerator_H
3
4
#include <stdint.h>
5
#include <stdlib.h>
6
8
class
LinearCongruentialGenerator
{
9
public
:
11
LinearCongruentialGenerator
() {
init
(); }
12
14
LinearCongruentialGenerator
(
int
seed
):
seed_
(seed),
value_
(seed) {}
15
17
void
init
();
18
20
void
reset
() {
value_
=
seed_
; }
21
23
void
reseed
(
int
seed
) {
value_
=
seed_
=
seed
; }
24
26
int
seed
()
const
{
return
seed_
; }
27
29
uint64_t
again
()
const
{
return
value_
; }
30
32
uint64_t
max
();
33
39
uint64_t
next
(
size_t
nbits=64,
size_t
niter=1);
40
uint64_t
operator()
() {
return
next
(); }
44
bool
flip_coin
();
45
46
protected
:
47
int
seed_
;
48
uint64_t
value_
;
49
};
50
51
typedef
LinearCongruentialGenerator
LCG
;
52
53
#endif
rose-edg4x
src
roseSupport
LinearCongruentialGenerator.h
Generated on Mon May 5 2014 17:29:24 for ROSE by
1.8.4