randall at randallreetz.com
Wed Nov 12 20:18:19 CST 2008
There is a huge difference between random and unique. If you are after unique then just use the counting numbers. If you need both random and unique you will have to check each number generated against a saved list of every previous number. There is nothing wrong with a random number generator that spits out duplicate numbers. Random is blind to history (and future). Random is not nostalgic. A coin with two sides is just as good at random as a pair of thousand sided dice.
From: "Dave Cragg" <dave.cragg at lacscentre.co.uk>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: 11/12/2008 5:26 PM
Subject: Re: Random algorithm
> It would seem that resetting the randomSeed each time you use the
> random function would only have a 1-in-4,570,422 chance of getting
> the same seed as the previous run, no?
Yes, but the chances of having the same seed as any of teh previous
runs becomes progressively larger. Is it not a bit like the shared
birthdays in a classroom. It only takes 23 people gathered in a room
to make the chance of two of them sharing a birthday more than 50%.
From my probably poor calculation, I think if you ran your randomSeed
algorithm about 2500 times, there would be a 50% chance that the same
randomSeed had been chosen at least twice. (At 4000, I think the
chance is over 80%) In many situations, I think a repeated sequence
would be worse than a biased sequence.
A long time since I did this kind of thing, so apologies if I have
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode