From 79843b51267d7a8faf8e9dcee09fa5e167373e6d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 18:15:04 +0000 Subject: Added seed parameter to constructor of two PRNGs. Also fixed horrible mistake in RandomBasic. --- src/stable/randombasic.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/stable/randombasic.h') 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 @@ namespace Bu { + /** + * Basic Linear Congruential Generator. This is one of the simplest and + * most common pseudo-random number generators out there. It's simple, + * fast, and does a decent job if you don't have any stastistical + * requirements other than "random looking." This is the algorithm included + * as the default random number generator in most standard libraries, + * although this one uses larger numbers internally, has a longer period, + * and more even distrubition of randomness accross it's bits than most + * implementations. + * + * The base values were published by Donald Knuth. + */ class RandomBasic : public RandomBase { public: - RandomBasic(); + RandomBasic( int32_t iSeed=0 ); virtual ~RandomBasic(); virtual void seed( int32_t iSeed ); @@ -22,7 +34,7 @@ namespace Bu virtual int32_t rand(); private: - int64_t a, c, x; + int64_t x; }; }; -- cgit v1.2.3