My co-worker was troubleshooting why some of our unittests (that work on
multiple operating systems and architectures) failed on OpenBSD and saw
that if you call srandom(0) to initialize the RNG, random() will always
return 0. (I was able to reproduce this.)
If this is expected behaviour,
On 2012/03/21 12:37, Jeremy C. Reed wrote:
My co-worker was troubleshooting why some of our unittests (that work on
multiple operating systems and architectures) failed on OpenBSD and saw
that if you call srandom(0) to initialize the RNG, random() will always
return 0. (I was able to
= div(state[i-1], 127773);
Already fixed.
CVSROOT:/cvs
Module name:src
Changes by: mill...@cvs.openbsd.org 2012/03/21 06:36:49
Modified files:
lib/libc/stdlib: random.c
Log message:
Fix a bug where random() always returns 0 when srandom() is seeded
with 0. Use 1 and not 0
On 2012/03/21 17:41, Stuart Henderson wrote:
On 2012/03/21 12:37, Jeremy C. Reed wrote:
My co-worker was troubleshooting why some of our unittests (that work on
multiple operating systems and architectures) failed on OpenBSD and saw
that if you call srandom(0) to initialize the RNG,
] = 123459876;
val = div(state[i-1], 127773);
I assume you don't read the source-changes list.
CVSROOT:/cvs
Module name:src
Changes by: mill...@cvs.openbsd.org 2012/03/21 06:36:49
Modified files:
lib/libc/stdlib: random.c
Log message:
Fix a bug where random() always returns
On Wed, Mar 21, 2012 at 12:37:47PM -0500, Jeremy C. Reed wrote:
My co-worker was troubleshooting why some of our unittests (that work on
multiple operating systems and architectures) failed on OpenBSD and saw
that if you call srandom(0) to initialize the RNG, random() will always
return 0.
Hi Jeremy,
On Wed, Mar 21, 2012 at 12:37:47PM -0500, Jeremy C. Reed wrote:
| My co-worker was troubleshooting why some of our unittests (that work on
| multiple operating systems and architectures) failed on OpenBSD and saw
| that if you call srandom(0) to initialize the RNG, random() will