Clean up bogosities in use of random(3) and srandom(3) --- do not assume
Tom Lane <tgl@sss.pgh.pa.us>
Clean up bogosities in use of random(3) and srandom(3) --- do not assume that RAND_MAX applies to them, since it doesn't. Instead add a config.h parameter MAX_RANDOM_VALUE. This is currently set at 2^31-1 but could be auto-configured if that ever proves necessary. Also fix some outright bugs like calling srand() where srandom() is appropriate.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +12 −0 |
| doc/src/sgml/ref/set.sgml | modified | +3 −3 |
| src/backend/optimizer/geqo/geqo_main.c | modified | +3 −3 |
| src/backend/postmaster/postmaster.c | modified | +2 −3 |
| src/backend/utils/adt/float.c | modified | +3 −3 |
| src/backend/utils/adt/misc.c | modified | +8 −6 |
| src/include/config.h.in | modified | +10 −1 |
| src/include/optimizer/geqo_random.h | modified | +6 −6 |