From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | stimits(at)comcast(dot)net |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Random not so random |
Date: | 2004-10-04 20:51:46 |
Message-ID: | 2409.1096923106@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"D. Stimits" <stimits(at)comcast(dot)net> writes:
> Tom Lane wrote:
>> Hmm. postmaster.c does this during startup of each backend process:
>>
>> gettimeofday(&now, &tz);
>> srandom((unsigned int) now.tv_usec);
> If it uses the same seed from the connection, then all randoms within a
> connect that has not reconnected will use the same seed. Which means the
> same sequence will be generated each time, which is why it is
> pseudo-random and not random. For it to be random not just the first
> call of a new connection, but among all calls of new connection, it
> would have to seed it based on time at the moment of query and not at
> the moment of connect. A pseudo-random generator using the same seed
> will generate the same sequence.
Did you read what I said? Or experiment?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Taber, Mark | 2004-10-04 20:55:12 | Re: PostgreSQL 8.0 install woes |
Previous Message | Hannu Krosing | 2004-10-04 20:47:37 | Re: [HACKERS] OT moving from MS SQL to PostgreSQL |