Further adjustment to random() seed initialization.
Per complaint from Tom Lane, don't chomp the timestamp at 32 bits, so we can shift in some of its higher bits. Discussion: https://postgr.es/m/14712.1542253115%40sss.pgh.pa.us
This commit is contained in:
parent
5b0ce3ec33
commit
ab8984f52d
@ -2532,9 +2532,9 @@ InitProcessGlobals(void)
|
|||||||
* in a given time period. Since that would leave only 20 bits of the
|
* in a given time period. Since that would leave only 20 bits of the
|
||||||
* timestamp that cycle every ~1 second, also mix in some higher bits.
|
* timestamp that cycle every ~1 second, also mix in some higher bits.
|
||||||
*/
|
*/
|
||||||
srandom(((unsigned int) MyProcPid) ^
|
srandom(((uint64) MyProcPid) ^
|
||||||
((unsigned int) MyStartTimestamp << 12) ^
|
((uint64) MyStartTimestamp << 12) ^
|
||||||
((unsigned int) MyStartTimestamp >> 20));
|
((uint64) MyStartTimestamp >> 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user