lemon/random.h
changeset 1129 39b6e65574c6
parent 584 33c6b6e755cd
child 1132 0998f70d0b2d
child 1134 f70f688d9ef9
equal deleted inserted replaced
27:da6e46354624 28:fb0415a0a3e5
   197         Iterator it = begin; int cnt = 0;
   197         Iterator it = begin; int cnt = 0;
   198         int num;
   198         int num;
   199 
   199 
   200         initState(init);
   200         initState(init);
   201 
   201 
   202         num = length > end - begin ? length : end - begin;
   202         num = static_cast<int>(length > end - begin ? length : end - begin);
   203         while (num--) {
   203         while (num--) {
   204           curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
   204           curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
   205             + *it + cnt;
   205             + *it + cnt;
   206           ++it; ++cnt;
   206           ++it; ++cnt;
   207           if (it == end) {
   207           if (it == end) {
   211             curr = state + length - 1; curr[0] = state[0];
   211             curr = state + length - 1; curr[0] = state[0];
   212           }
   212           }
   213           --curr;
   213           --curr;
   214         }
   214         }
   215 
   215 
   216         num = length - 1; cnt = length - (curr - state) - 1;
   216         num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
   217         while (num--) {
   217         while (num--) {
   218           curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
   218           curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
   219             - cnt;
   219             - cnt;
   220           --curr; ++cnt;
   220           --curr; ++cnt;
   221           if (curr == state) {
   221           if (curr == state) {