Re: [GENERAL] Re: random() function produces wrong range - Mailing list pgsql-hackers

From Roland Roberts
Subject Re: [GENERAL] Re: random() function produces wrong range
Date
Msg-id m2n1iuz1q6.fsf@tycho.rlent.pnet
Whole thread Raw
In response to random() function produces wrong range  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

    Tom> Actually the odds are far better than that.  If the range is
    Tom> 2^31-1 then only about 2^-16th of the outputs should be less
    Tom> than 2^15.  So ten probes gives you a failure probability of
    Tom> about 2^-160 not 2^-10.

Oops, 2^16 != 2^32 / 2.

So a dynamic test is not only possible but wouldn't cost to much at
configure time.

roland
- --
               PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                    Unix Software Solutions
roberts@panix.com                      76-15 113th Street, Apt 3B
rbroberts@acm.org                          Forest Hills, NY 11375

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv
Comment: Processed by Mailcrypt 3.5.4, an Emacs/PGP interface

iQCVAwUBOYmtf+oW38lmvDvNAQGWYwP/eXRtrDPu/xN+W9pCd9y34d4jbrPH7jku
nBAuSYtCRyoMgTkjdCtqThzq3vzPLDwfmOZcmWP8W5AmQPJjvcdFwI7y1XgGlaxd
aAIlqqf+TTkZwIUh2vnWTuu5JKkiAZI6UuzNSzy79O/frxKE2y97zCuMw02I0kMK
iGNSybN3L5w=
=36yP
-----END PGP SIGNATURE-----

pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: comparing rows
Next
From: Roland Roberts
Date:
Subject: RPM buglet, postgres-devel