Re: pgbench - add pseudo-random permutation function - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench - add pseudo-random permutation function
Date
Msg-id alpine.DEB.2.21.1810241154210.30118@lancre
Whole thread Raw
In response to Re: pgbench - add pseudo-random permutation function  (Hironobu SUZUKI <hironobu@interdb.jp>)
Responses Re: pgbench - add pseudo-random permutation function
Re: pgbench - add pseudo-random permutation function
List pgsql-hackers
Hello Hironobu-san,

> In pseudorandom_perm(), `modular_multiply() + (key >> LCG_SHIFT)` may 
> overflow if the result of modular_multiply() is large. Therefore, I've 
> improved it.

> Also, I've simplified Step 5 in modular_multiply().

Attached is a v10, where I have:
  - updated some comments
  - the + cannot overflow because size is taken from a signed int
    and the added value is small thanks to the shift.
    I have put back the simple formula and added a comment about it.
  - added a few test cases, and fix the associated checks

-- 
Fabien.
Attachment

pgsql-hackers by date:

Previous
From: AYahorau@ibagroup.eu
Date:
Subject: Re: Timeout parameters
Next
From: Michael Meskes
Date:
Subject: Re: [PROPOSAL]a new data type 'bytea' for ECPG