Ticket #4371: linear_congruential.patch

File linear_congruential.patch, 858 bytes (added by Chris Jefferson, 12 years ago)

linear_congruential patch

  • boost/random/linear_congruential.hpp

     
    148148        static const int log = ::boost::static_log2<m>::value;
    149149        static const int k =
    150150            (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);
    153153        IntType s = 0;
    154154        IntType mul = 1;
    155155        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);
    157157            mul <<= 32;
    158158        }
    159159        seed(s);