KSquare Utilities
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
RandomNumGenerator.h
Go to the documentation of this file.
1
/* RandomNumGenerator.h -- Class that represents one Random Number Generator.
2
* Copyright (C) 1994-2014 Kurt Kramer
3
* For conditions of distribution and use, see copyright notice in KKB.h
4
*/
5
#
ifndef
_KKU_RANDOMNUMGENERATOR_
6
#
define
_KKU_RANDOMNUMGENERATOR_
7
8
#
include
"KKBaseTypes.h"
9
10
namespace
KKB
11
{
12
/**
13
*@brief Represents one single random number generator.
14
*@details Rather than using the two global functions "lrand48" and "srand48" you can create an
15
* instance of this class that will provide the random sequence. The advantage is that
16
* you can control who has access to this sequence. That is you do not need to worry that
17
* some other code that you are calling is not also getting numbers from this sequence.
18
* This will allow you to guarantee the same sequence of numbers for the same seed.
19
*/
20
class
RandomNumGenerator
21
{
22
public
:
23
RandomNumGenerator
();
24
RandomNumGenerator
(
long
_seed);
25
26
~
RandomNumGenerator
();
27
28
long
Next
();
29
30
31
private
:
32
kkint64
_lrand48_sequence;
33
34
static
const
kkint64
a;
35
static
const
kkint64
c;
36
static
const
kkint64
m;
37
static
const
kkint64
mask;
38
};
/* RandomNumGenerator */
39
}
40
41
#
endif
KKB::RandomNumGenerator::Next
long Next()
Definition:
RandomNumGenerator.cpp:63
KKB::RandomNumGenerator::~RandomNumGenerator
~RandomNumGenerator()
Definition:
RandomNumGenerator.cpp:45
KKB::kkint64
__int64 kkint64
Definition:
KKBaseTypes.h:90
KKB::KKTHreadPtr
KKTHread * KKTHreadPtr
Definition:
KKThreadManager.h:20
KKB::RandomNumGenerator
Represents one single random number generator.
Definition:
RandomNumGenerator.h:20
KKB::RandomNumGenerator::RandomNumGenerator
RandomNumGenerator(long _seed)
Definition:
RandomNumGenerator.cpp:35
KKB::RandomNumGenerator::RandomNumGenerator
RandomNumGenerator()
Definition:
RandomNumGenerator.cpp:25
KKBase
RandomNumGenerator.h
Generated on Thu Mar 31 2016 22:46:11 for KSquare Utilities by
1.8.11