Andrey A. Chernov 476d9314d6 1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range,
but ACM formula we use have internal state (and return value) in the
[1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached
because it is off by one, zero is not reached too.

Correct both RAND_MAX and rand(3) return value, shifting last one
to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new RAND_MAX)]
range.

2) Add a checks for not overflowing on too big seeds. It may happens on
the machines, where sizeof(unsigned int) > 32 bits.

Reviewed by:    bde [1]
MFC after:      2 weeks
2013-07-03 21:21:54 +00:00
..
2013-03-27 10:11:43 +00:00
2013-03-22 13:36:03 +00:00
2013-01-01 18:29:25 +00:00
2013-06-29 15:51:27 +00:00
2013-04-14 00:59:56 +00:00
2013-05-30 08:02:00 +00:00
2013-05-12 22:22:12 +00:00
2012-10-18 15:39:29 +00:00
2013-05-12 22:22:12 +00:00
2013-06-07 13:45:58 +00:00
2013-06-29 15:52:48 +00:00
2013-05-05 06:20:49 +00:00