aboutsummaryrefslogtreecommitdiff
path: root/src/stable/randombasic.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-09 18:15:04 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-09 18:15:04 +0000
commit79843b51267d7a8faf8e9dcee09fa5e167373e6d (patch)
treecc317f202fa6b7b68908af9bee1848355681db78 /src/stable/randombasic.h
parentba177923d7b60800ae2e01f80fc10dc8ad1594bb (diff)
downloadlibbu++-79843b51267d7a8faf8e9dcee09fa5e167373e6d.tar.gz
libbu++-79843b51267d7a8faf8e9dcee09fa5e167373e6d.tar.bz2
libbu++-79843b51267d7a8faf8e9dcee09fa5e167373e6d.tar.xz
libbu++-79843b51267d7a8faf8e9dcee09fa5e167373e6d.zip
Added seed parameter to constructor of two PRNGs. Also fixed horrible mistake
in RandomBasic.
Diffstat (limited to 'src/stable/randombasic.h')
-rw-r--r--src/stable/randombasic.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/stable/randombasic.h b/src/stable/randombasic.h
index 4d1c2f8..c9b7072 100644
--- a/src/stable/randombasic.h
+++ b/src/stable/randombasic.h
@@ -11,10 +11,22 @@
11 11
12namespace Bu 12namespace Bu
13{ 13{
14 /**
15 * Basic Linear Congruential Generator. This is one of the simplest and
16 * most common pseudo-random number generators out there. It's simple,
17 * fast, and does a decent job if you don't have any stastistical
18 * requirements other than "random looking." This is the algorithm included
19 * as the default random number generator in most standard libraries,
20 * although this one uses larger numbers internally, has a longer period,
21 * and more even distrubition of randomness accross it's bits than most
22 * implementations.
23 *
24 * The base values were published by Donald Knuth.
25 */
14 class RandomBasic : public RandomBase 26 class RandomBasic : public RandomBase
15 { 27 {
16 public: 28 public:
17 RandomBasic(); 29 RandomBasic( int32_t iSeed=0 );
18 virtual ~RandomBasic(); 30 virtual ~RandomBasic();
19 31
20 virtual void seed( int32_t iSeed ); 32 virtual void seed( int32_t iSeed );
@@ -22,7 +34,7 @@ namespace Bu
22 virtual int32_t rand(); 34 virtual int32_t rand();
23 35
24 private: 36 private:
25 int64_t a, c, x; 37 int64_t x;
26 }; 38 };
27}; 39};
28 40