Hello, On 2021-Mar-13, Fabien COELHO wrote:
> This looks like a good compromise, which can even be a little better because > we still have 64 bits ints. Yeah, we rely on those being available elsewhere. > Attached a simplified patch which does that, removing 1/3 of the code. What > do you think? Clearly we got rid of a lot of code. About the tests, maybe the easiest thing to do is "skip ... if $Config{'osname'} eq 'MSWin32'". One comment in pseudorandom_perm talks about "whitening" while the other talks about "scramble". I think they should both use the same term to ease understanding. You kept routine nbits() which is unneeded now. pgbench.c gains too many includes for my taste. Can we put pseudorandom_perm() in a separate file? The function name pr_perm() is much too short; I think we should use a more descriptive name; maybe \prand_perm is sufficient? Though I admit the abbreviation "perm" evokes "permission" more than "permutation" to me, so maybe \prand_permutation is better? (If you're inclined to abbreviate permutation, maybe \prand_permut?) I think the reference docs are not clear enough. What do you think of something like this? > + <row> > + <entry role="func_table_entry"><para role="func_signature"> > + <function>pr_perm</function> ( <parameter>i</parameter>, > <parameter>size</parameter> [, <parameter>seed</parameter> ] ) > + <returnvalue>integer</returnvalue> > + </para> > + <para> > + i'th pseudo-random permutation in <literal>[0,size)</literal> > + <!-- "The i'th value of the pseudo-random permutation in the interval > [0,size)"? --> > + </para> > + <para> > + <literal>pr_perm(2, 4)</literal> > + <returnvalue>the 2nd integer between 0 and (4-1)</returnvalue> > + </para></entry> > + </row> -- Álvaro Herrera Valdivia, Chile