The "random" regression test uses a function called oidrand(), which
takes two parameters, an OID x and an integer y, and returns "true" with
probability 1/y (the OID argument is ignored). This can be useful -- for
example, it can be used to select a random sampling of the rows in a
table (which is what the "random" regression test uses it for).
This patch removes that function, because it was old and messy. The old
function had the following problems:
- it was undocumented
- it was poorly named
- it was designed to workaround an optimizer bug that no longer exists
(the OID argument is to ensure that the optimizer won't optimize away
calls to the function; AFAIK marking the function as 'volatile' suffices
nowadays)
- it used a different random-number generation technique than the other
PSRNG-related functions in the backend do (it called random() like they
do, but it had its own logic for setting a set and deciding when to
reseed the RNG).
This patch implements a new version of the function, called
"random_sample" (if you think that's not a good name, please suggest an
improvement). It corrects the problems mentioned above.
I also documented the setseed() function: there were some SGML docs for
it, but they were commented out (Peter E. removed them revision 1.41 of
func.sgml, without explaining why).
Finally, I removed the oidsrand() and userfntest() functions: the former
was only for use with oidrand(), and the later has no value AFAICS (I
checked with Bruce, and he agreed with me).
Initdb required.
Cheers,
Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC