From 2d6f5f0903bd97a38056a65431b07bb7baf5039a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 20 Jun 2012 07:41:37 +0000 Subject: Silly RandomCmwc, it was using a static variable somewhere. That's fixed now. --- src/stable/randomcmwc.cpp | 7 +++---- src/stable/randomcmwc.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/stable/randomcmwc.cpp b/src/stable/randomcmwc.cpp index a4e807e..ccfc4a9 100644 --- a/src/stable/randomcmwc.cpp +++ b/src/stable/randomcmwc.cpp @@ -23,20 +23,19 @@ Bu::RandomCmwc::~RandomCmwc() void Bu::RandomCmwc::seed( int32_t iSeed ) { - int i; + i = 4096; q[0] = iSeed; q[1] = iSeed + PHI; q[2] = iSeed + PHI + PHI; - for (i = 3; i < 4096; i++) - q[i] = q[i - 3] ^ q[i - 2] ^ PHI ^ i; + for (int j = 3; j < 4096; j++) + q[j] = q[j - 3] ^ q[j - 2] ^ PHI ^ j; } int32_t Bu::RandomCmwc::rand() { uint64_t t, a = 18782LL; - static uint32_t i = 4095; uint32_t x, r = 0xfffffffe; i = (i + 1) & 4095; t = a * q[i] + c; diff --git a/src/stable/randomcmwc.h b/src/stable/randomcmwc.h index 747eb6a..fff891b 100644 --- a/src/stable/randomcmwc.h +++ b/src/stable/randomcmwc.h @@ -22,7 +22,7 @@ namespace Bu virtual int32_t rand(); private: - uint32_t *q, c; + uint32_t *q, c, i; }; }; -- cgit v1.2.3