Re: OSX 10.2.2 and beta 5

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Theodore Petrosky <tedpet5(at)yahoo(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: OSX 10.2.2 and beta 5
Date: 2002-11-17 03:18:34
Message-ID: 20021117031834.GA23310@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Nov 16, 2002 at 15:18:58 -0500,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> "Random" randomly fails. It is OK.
>
> > So why is it a regression test, then?
>
> It's hard to see how you could test random() in a completely
> deterministic fashion ...

You could use the floor function and check that function call works and
that returned values are in the range >= 0 and < 1 (the description just
says between but this is the normal range).
You could also do a couple of selects that compare random's output to
each other to see if it is generating a constant. The odds of this
happening by chance are very small. If you tie a couple of these
together you should be able to reduce the chances to whatever you
think is safe.
The odds of the following returning true should be less than the chances
of a hardware hiccup:
select random() = random() and random() = random();
The following should always return 0 (assuming I am right about random
being strictly less than 1):
select floor(random());

You can probably come up with other tricks. For example for a large sample
you should be able to put a bound on the average for which the probability
of the average being outside that bound is comparable to the test for
random returning constant values.
The variance is something else that could be tested this way.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-11-17 04:13:43 Bug #819:
Previous Message Tom Lane 2002-11-16 20:18:58 Re: OSX 10.2.2 and beta 5