Skip to content

Commit ab8984f

Browse files
committed
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
1 parent 5b0ce3e commit ab8984f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,9 +2532,9 @@ InitProcessGlobals(void)
25322532
* in a given time period. Since that would leave only 20 bits of the
25332533
* timestamp that cycle every ~1 second, also mix in some higher bits.
25342534
*/
2535-
srandom(((unsigned int) MyProcPid) ^
2536-
((unsigned int) MyStartTimestamp << 12) ^
2537-
((unsigned int) MyStartTimestamp >> 20));
2535+
srandom(((uint64) MyProcPid) ^
2536+
((uint64) MyStartTimestamp << 12) ^
2537+
((uint64) MyStartTimestamp >> 20));
25382538
}
25392539

25402540

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy