--- deliantra/server/common/utils.C 2007/02/15 18:09:33 1.48 +++ deliantra/server/common/utils.C 2007/04/21 22:57:15 1.49 @@ -44,10 +44,10 @@ void tausworthe_random_generator::seed (uint32_t seed) { - state [0] = max ( 2U, seed * 69069U); - state [1] = max ( 8U, state [0] * 69069U); - state [2] = max ( 16U, state [1] * 69069U); - state [3] = max (128U, state [2] * 69069U); + state [0] = seed * 69069U; if (state [0] < 2U) state [0] += 2U; + state [1] = state [0] * 69069U; if (state [0] < 8U) state [0] += 8U; + state [2] = state [1] * 69069U; if (state [0] < 16U) state [0] += 16U; + state [3] = state [2] * 69069U; if (state [0] < 128) state [0] += 128U; for (int i = 11; --i; ) operator ()(); @@ -67,14 +67,14 @@ uint32_t tausworthe_random_generator::get_range (uint32_t r_max) { - return next () % r_max; + return (next () * (uint64_t)r_max) >> 32U; } // return a number within (min .. max) int tausworthe_random_generator::get_range (int r_min, int r_max) { - return r_min + (*this) (max (r_max - r_min + 1, 1)); + return r_min + get_range (max (r_max - r_min + 1, 1)); } /*