RE: [Algorithms] Random Numbers
Brought to you by:
vexxed72
From: Robert D. <RD...@ac...> - 2000-09-08 09:43:30
|
> Does anyone know of a good book or other reference that'd > explain various > aspects of generating random numbers to someone that's not so much > mathematically inclined? E.g. how to test whether a random number > generator is good etc? No, but you need to be aware that there is no such thing as 'good' - there are some cases which are obviously 'bad', if say you can never get certain numbers or if the distribution is skewed, but even when this isn't the case, the way you are making use of the numbers will effect how 'good' the generator is. You will often find that random number generators create patterns, which can have a dramatic effect on your results. For example, if you take a typical psuedo random number generator and use its output as input to a random walk - for example doing : x += rand()-0.5; y += rand()-0.5; then in many cases you will notice a long term drift, which is quite slow. if on the other hand you are using integers, and you take the bottom few bits, you will get a much more marked drift. also, very often you can make your randomness appear to be much greater by using it more ... for example if you use the same random number generator for jiggling sprites, making AI decisions, and so on, then you will find they each appear more random, because any patterns are lost by something else using the values in between. finally if you really need to use several random numbers one after another, check the behaviour for that specific case as many times as you can, to ensure you know what its doing. Rob |