Re: Random strings

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Joe Conway <joseph.conway@home.com>
Cc: "Dr. Evil" <drevil@sidereal.kz>, <pgsql-patches@postgresql.org>
Date: 2001-08-08T19:21:09Z
Lists: pgsql-general
Joe Conway writes:

> Per the discussion yesterday, here's a patch. There are two versions of
> essentially the same function. They both take an int as the number of
> requested random bytes, and generate a random binary string of the requested
> length from /dev/urandom. The first one (randomstr_hex) converts the binary
> to hex and returns it as text, and the other (randomstr_bytea) does the
> needed escaping of special characters and returns bytea.

Perhaps one of these returning bytea would be enough and you can use
the new encode functions to convert them to a format of choice.  Also, why
aren't you using /dev/random?

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter