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

Re: random() function produces wrong range

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org, pgsql-general(at)postgreSQL(dot)org
Subject: Re: random() function produces wrong range
Date: 2000-08-01 18:23:38
Message-ID: 27204.965154218@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> Actually, on my machines, both man pages for rand() and random() say
> they return values between 0 and RAND_MAX (whether that's true or not
> is another matter).  In my case RAND_MAX==INT_MAX so the change wouldn't
> be a problem, but it might be problematic on some of the 64 bit machines.

Oh, that's interesting.  What platform do you use?  If RAND_MAX applies
to random() on some machines that'd probably explain why the code is
written like it is.  But on my box (HPUX) the rand() function is old
and crufty and considerably different from random().

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2000-08-01 18:33:18
Subject: Re: random() function produces wrong range
Previous:From: Stephan SzaboDate: 2000-08-01 17:46:46
Subject: Re: random() function produces wrong range

pgsql-general by date

Next:From: Tom LaneDate: 2000-08-01 18:33:18
Subject: Re: random() function produces wrong range
Previous:From: Fetter, David MDate: 2000-08-01 18:23:13
Subject: RE: Postgres connect with Access

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