[pgpool-hackers: 4597] Re: Shuffle random functions and use better random numbers
Tatsuo Ishii
ishii at postgresql.org
Wed May 21 15:58:31 JST 2025
> I have pushed the patch to master branch, with slightly modified
> commit message, and credited you as a reviewer.
Attached is the followup commit to import pg_prng.c and use
pg_prng_double() for calculating a random number between 0 and 1.0.
Actually pg_prng_double() generates a random number [0, 1.0) (1.0 is
not inclusive), I think it's ok for our purpose.
[ from the commit message]
Other notes regarding the port:
- pg_prng needs to be initialized using pg_prng_strong_seed() per
process. Currently the only caller is child.c (per session
process). If other process needs to use pg_prng, it needs the same
initialization as child.c.
- Some of functions in the file were not ported because they require
additional library: pg_bitutils.c. In the future we may revisit and
import pg_bitutils.c.
- likely/unlikely are ignored. In the future we may revisit and import
them.
- All conditional compiling regarding "sun" or "_sun" are removed. It
seems the platform is not used for running pgpool anymore.
- Since srandom() is not necessary any more, related code are removed
from pgpool_main.c, child.c and pcp_worker.c.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v1-0001-Replace-random-with-pg_prng-random-function.patch
Type: application/octet-stream
Size: 18637 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20250521/b444d054/attachment.obj>
More information about the pgpool-hackers
mailing list