Red Hat Bugzilla – Bug 1301913
Incorrect rand() result when seed >=2^31
Last modified: 2016-02-01 12:22:42 EST
Description of problem:
RHEL5 and RHEL6 generates different rand() result with same seed when the seed >=2^31
This issue is particular to RHEL 5 64 bit
Version-Release number of selected component (if applicable):
Steps to Reproduce:
With below code
int main ()
unsigned int nSeed = 2147483648; // or any number bigger than this
printf ("Seed: %d\n", nSeed);
printf ("Random number: %d\n", rand());
Random number: 1336741213
Random number: 722473798
For RHEL 6 This issue was fixed in upstream  by turning long int to int32_t
struct random_data *buf;
long int i;
Bugzilla @ https://sourceware.org/bugzilla/show_bug.cgi?id=9920
Bug fix @ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fe12c7984b6631cf5e7b66d97f51f4aa16fd821e
It seems to me that the upstream change you identified was made to bring 32-bit and 64-bit platforms in line, giving both them the same sequence with the same seed. This means that the behavior in Red Hat Enterprise Linux 6 is more correct than the previous behavior in Red Hat Enterprise Linux 5.
We do not want to change Red Hat Enterprise Linux 5 at this point because other customers could expect that rand keeps generating the same number sequence from the same seed, even after a glibc upgrade within the same major release of Red Hat Enterprise Linux 5.
Please let us know if this addresses your concerns.
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Thanks for details, this addresses customer concern.
We good to close the bug.
Given that we're not going to fix this for RHEL5 I'm marking this CLOSED/WONTFIX. Please open another bug if you have any more questions.