Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

random in ACL 5

0 views
Skip to first unread message

Andreas Eder

unread,
Apr 11, 1999, 3:00:00 AM4/11/99
to
I think I found some problem with ACL but want to check with this
forum first, wether someone else has also found this stange behaviour.

The version of ACL is:
Allegro CL Trial Edition 5.0 [Linux/X86] (2/14/99 11:33)

'random' seems to have a problem with bigger numbers.
(random (expt 10 10)) e.g. seems to deliver random numbers of quite
acceptable quality, but for bigger numbers like (random (expt 10 20))
i always get even integers, which is surely not what i would
expect. Test it with
(dotimes (i 10) (format t "~&~D" (random (expt 10 20))))

Is this a known bug? Any comments?

Andreas

--
Wherever I lay my .emacs, there's my $HOME

Kent M Pitman

unread,
Apr 12, 1999, 3:00:00 AM4/12/99
to
Andrea...@t-online.de (Andreas Eder) writes:

> I think I found some problem with ACL but want to check with this
> forum first, wether someone else has also found this stange behaviour.

> ... (random (expt 10 10)) e.g. seems to deliver random numbers of quite


> acceptable quality, but for bigger numbers like (random (expt 10 20))
> i always get even integers, which is surely not what i would
> expect.

Unless you are questioning your own understanding of what RANDOM
should do (and I hope you are not, since I agree with your apparent
position that random should sometimes return odd numbers), you should
just send a bug report to the vendor in question and skip the
intermediate step of asking this group, which only delays getting the
report into the queue to be fixed.

Just my opinion.

Lieven Marchand

unread,
Apr 12, 1999, 3:00:00 AM4/12/99
to
Andrea...@t-online.de (Andreas Eder) writes:

> I think I found some problem with ACL but want to check with this
> forum first, wether someone else has also found this stange behaviour.
>

> The version of ACL is:
> Allegro CL Trial Edition 5.0 [Linux/X86] (2/14/99 11:33)
>
> 'random' seems to have a problem with bigger numbers.

> (random (expt 10 10)) e.g. seems to deliver random numbers of quite
> acceptable quality, but for bigger numbers like (random (expt 10 20))
> i always get even integers, which is surely not what i would

> expect. Test it with
> (dotimes (i 10) (format t "~&~D" (random (expt 10 20))))

You will find in doc/cl/implementation.htm that they use only 48 bit
integer seed and multiplier. The effect that you describe starts to
happen around 46 bit limits.

In the CMUCL sources you can find a random number generator based on
the Mersenne Twister that looks fairly portable and that doesn't
exhibit this behaviour. Testing random generators is still somewhat of
a black art though, so it may have other undesirable properties.

--
Lieven Marchand <m...@bewoner.dma.be>
If there are aliens, they play Go. -- Lasker

0 new messages