Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Aug 3, 2011 at 5:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hmm. I find the pgbench part of this a bit questionable, specifically
>> your decision to remove the code around line 2590 that installed a
>> variable srandom() seed in child processes.
> Unless I'm asleep at the switch, the srandom() calls you're worrying
> about execute in the parent thread, which still makes its own call to
> srandom().
[ looks more closely... ] OK, you're right: the per-"thread" random
seeds are initialized in the parent process and then propagated to child
processes by fork(); we'll never call random() in the children so
there's no need to make their states diverge. Never mind.
I do however notice a vestigial reference to MAX_RANDOM_VALUE at line
1063, which we probably should get rid of. What I think we probably
need instead, and don't have, is a check that "max - min + 1" doesn't
overflow.
regards, tom lane