> I am running on OpenBSD and Linux, both of which have
> cryptographic-quality RNGs built in. When I call RANDOM() in PG, do I
> get the old C library random numbers, which are not very random, or do
> I get high-quality random numbers from the crypto-RNG that's built in?
> Any sugestions for getting high-quality random numbers?
Looking through the source, I find:
/*
* drandom - returns a random number
*/
Datum
drandom(PG_FUNCTION_ARGS)
{
float8 result;
/* result 0.0-1.0 */
result = ((double) random()) / ((double) MAX_RANDOM_VALUE);
PG_RETURN_FLOAT8(result);
}
Looks like plain old C library random numbers. If you want to use
/dev/random or /dev/urandom, best bet would be to write your own C function.
You should also check through the contrib stuff -- I don't recall seeing RNG
functions in there, but I'm constantly amazed at what is in contrib that I
didn't notice before ;-)
HTH,
Joe