Re: Newbie question on discrete distribution of random numbers
- From: bart demoen <bmd@xxxxxxxxxxxxxx>
- Date: Fri, 12 Oct 2007 19:15:58 +0200
On Fri, 12 Oct 2007 19:17:42 +0200, Jason wrote:
Hi everybody,
I want to generate several hundred random numbers between 1 and 9 which
should be equally distributed.
Generating 900 random numbers should result in 100 for number 1, 100 for
number 2, and so on.
I'll come back to this later :-)
Any hints for a prolog code that can manage this task?
Check your manual for the word "random" and use the builtin that
your implementation provides.
There is really no quick way to do random numbers in Prolog, or any other
programming language. You should at least read the relevant chapter
from one of Knuth's books (there might be good substitutes on the net).
(LATER:) It shows that you haven't read the right things about random
numbers. But if you are satisfied with sequences of numbers that look
random enough to you without pushing it too hard, just do the obvious:
seed, multiply, modulo something etc. thing - that's everywhere on the net.
(and also in Knuth as a bad example :-)
Cheers
Bart Demoen
.
- References:
- Prev by Date: Re: Newbie question on discrete distribution of random numbers
- Next by Date: Re: Newbie question on discrete distribution of random numbers
- Previous by thread: Re: Newbie question on discrete distribution of random numbers
- Next by thread: Trying to setup a hierarchy of classes of things (SWI prolog)
- Index(es):