Random #s

Michael D Mays michael.rr at mdmays.com
Fri Jan 28 12:55:19 EST 2005


If you are asking the random of a big number then that will be true.

I think I remember that to generate a list of random numbers what you 
should be doing is asking questions like
random(N)
random(N-1)
.
.
.
1

If you wanted to generate a random list with the numbers 1 thru 10
random(10) -> 3
Now you pick the 3rd item of the list of integers{1,2,3,4,5,6,7,8,9,10} 
you pick 3 and remove the 3rd item.
Your random list is {3}
random(9)->3
Now you pick the 3rd item of the remaining integers 
{1,2,4,5,6,7,8,9,10}: you pick 4 and remove the 3rd item.
Your random list is {3,4}
And so on.

Michael

On Jan 27, 2005, at 7:35 AM, Dave Cragg wrote:

> Although I'm sure this is fine in practice, this kind of solution 
> always makes me a little nervous. In theory, it could take for ever to 
> find a unique set of numbers. While my testing shows it never takes 
> longer than a millisecond, Murphy's law says that the first time you 
> put it into an application, it will take three days. :)



More information about the Use-livecode mailing list