Ticket #4371: linear_congruential.patch
File linear_congruential.patch, 858 bytes (added by , 12 years ago) |
---|
-
boost/random/linear_congruential.hpp
148 148 static const int log = ::boost::static_log2<m>::value; 149 149 static const int k = 150 150 (log + ((~(static_cast<IntType>(1) << log) & m)? 32 : 31)) / 32; 151 boost::uint32_t a[k + 3];152 seq.generate(& a[0], &a[0] + k + 3);151 boost::uint32_t l[k + 3]; 152 seq.generate(&l[0], &l[0] + k + 3); 153 153 IntType s = 0; 154 154 IntType mul = 1; 155 155 for(int j = 0; j < k; ++j) { 156 s = const_mod<IntType, m>::mult_add( a[j + 3], mul, s);156 s = const_mod<IntType, m>::mult_add(l[j + 3], mul, s); 157 157 mul <<= 32; 158 158 } 159 159 seed(s);