Skip site navigation (1) Skip section navigation (2)

Re: win32 random number generator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: win32 random number generator
Date: 2005-08-22 20:47:46
Message-ID: 21049.1124743666@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
"Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> writes:
> The windows random number of generator (a port of lrand48 in random.c)
> seems a little weak.  It seems to only offer about 16 bits of precision.
> Maybe there is a bug in the implementation?

> esp=# select count(*)  from (select distinct random() from
> generate_series(1,1000000)) q;
>  count
> -------
>  65559
> (1 row)

That's pretty awful, all right.  I get numbers like this on two
different Unix machines:

regression=# select count(*)  from (select distinct random() from generate_series(1,1000000)) q;
 count
--------
 999769
(1 row)

postgres=#  select count(*)  from (select distinct random() from
postgres(# generate_series(1,1000000)) q;
 count
--------
 999787
(1 row)

Anyone care to burrow into the code and see what its problem is?

			regards, tom lane

In response to

pgsql-hackers-win32 by date

Next:From: Merlin MoncureDate: 2005-08-22 20:59:13
Subject: Re: win32 random number generator
Previous:From: Merlin MoncureDate: 2005-08-22 19:59:57
Subject: win32 random number generator

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group