Re: pgsql: Increase the number of possible random seeds per time period. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Increase the number of possible random seeds per time period.
Date
Msg-id 16659.1542255687@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Increase the number of possible random seeds per time period.  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-committers
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Thu, Nov 15, 2018 at 4:38 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Um, this bit is *not* right:

> Will this close the case?

> -       srandom(((unsigned int) MyProcPid) ^
> -                       ((unsigned int) MyStartTimestamp << 12) ^
> -                       ((unsigned int) MyStartTimestamp >> 20));
> +       srandom(((uint64) MyProcPid) ^
> +                       ((uint64) MyStartTimestamp << 12) ^
> +                       ((uint64) MyStartTimestamp >> 20));

WFM.

            regards, tom lane


pgsql-committers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: pgsql: Increase the number of possible random seeds per time period.
Next
From: Thomas Munro
Date:
Subject: pgsql: Further adjustment to random() seed initialization.