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): How reproducible:Always Steps to Reproduce: 1. With below code #include <stdio.h> #include <stdlib.h> int main () { unsigned int nSeed = 2147483648; // or any number bigger than this printf ("Seed: %d\n", nSeed); srand (nSeed); printf ("Random number: %d\n", rand()); return 0; } Actual results: Seed: -2147483648 Random number: 1336741213 Expected results: Seed -2147483648 Random number: 722473798 Additional info: For RHEL 6 This issue was fixed in upstream[1] [2] by turning long int to int32_t /usr/src/debug/glibc-2.12-2-gc4ccff1/stdlib/random_r.c struct random_data *buf; { int type; int32_t *state; long int i; int32_t word; int32_t *dst; int kc; [1]Bugzilla @ https://sourceware.org/bugzilla/show_bug.cgi?id=9920 [2]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.
Hi, Thanks for details, this addresses customer concern. We good to close the bug. Best Regards, Piyush
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.