ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/math/MersenneTwister.hpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/math/MersenneTwister.hpp (file contents):
Revision 2064 by tim, Tue Mar 1 03:55:13 2005 UTC vs.
Revision 2065 by tim, Tue Mar 1 14:45:45 2005 UTC

# Line 86 | Line 86 | class MTRand { (public)
86  
87   //Methods
88   public:
89 <        MTRand( const uint32& oneSeed, nstrides = 1, stride = 0);  // initialize with a simple uint32
90 <        MTRand( uint32 *const bigSeed, uint32 const seedLength = N, nstrides = 1, stride = 0);  // or an array
91 <        MTRand(nstrides = 1, stride = 0);  // auto-initialize with /dev/urandom or time() and clock()
89 >        MTRand( const uint32& oneSeed, int nstrides = 1, int stride = 0);  // initialize with a simple uint32
90 >        MTRand( uint32 *const bigSeed, uint32 const seedLength = N, int nstrides = 1, int stride = 0);  // or an array
91 >        MTRand(int nstrides = 1, int stride = 0);  // auto-initialize with /dev/urandom or time() and clock()
92          
93          // Do NOT use for CRYPTOGRAPHY without securely hashing several returned
94          // values together, otherwise the generator state can be learned after
# Line 189 | Line 189 | inline MTRand::uint32 MTRand::randInt()
189          // Pull a 32-bit integer from the generator state
190          // Every other access function simply transforms the numbers extracted here
191  
192 <        uint32 ranNums[nstrides];
192 >        uint32 ranNums[nstrides_];
193  
194 <        for (int i = 0; i < nstrides; ++i) {
194 >        for (int i = 0; i < nstrides_; ++i) {
195              if( left == 0 ) {
196                  reload();
197              }
# Line 203 | Line 203 | inline MTRand::uint32 MTRand::randInt()
203              s1 ^= (s1 >> 11);
204              s1 ^= (s1 <<  7) & 0x9d2c5680UL;
205              s1 ^= (s1 << 15) & 0xefc60000UL;
206 <            ranNums[i] = s1 ^ (s1 >> 18) );
206 >            ranNums[i] = s1 ^ (s1 >> 18);
207          }
208  
209 <        return ranNums[stride];
209 >        return ranNums[stride_];
210   }
211  
212   inline MTRand::uint32 MTRand::randInt( const uint32& n )

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines