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

Re: random() function produces wrong range

From: "Mike Sears" <msears(at)vianet(dot)ca>
To: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgreSQL(dot)org>, <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: random() function produces wrong range
Date: 2000-08-01 22:26:36
Message-ID: 002b01bffc07$907fd2d0$02945bd1@neutrino (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackers
What build of postgres is this running on. I've tried this on 6x and it
doesn't seem to work.

----- Original Message -----
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>
Sent: Tuesday, August 01, 2000 11:23 AM
Subject: Re: [GENERAL] random() function produces wrong range

> 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
> 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


pgsql-hackers by date

Next:From: Philip WarnerDate: 2000-08-01 23:12:02
Subject: Re: pg_dump & ownership (again)
Previous:From: Tom LaneDate: 2000-08-01 21:23:53
Subject: Re: Anyone care about type "filename" ?

pgsql-general by date

Next:From: KMillerDate: 2000-08-01 22:55:15
Subject: 1763 pq_flush messages
Previous:From: Tim UckunDate: 2000-08-01 21:27:24
Subject: Linking views and tables to access.

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