[futurebasic] Re: Random Number LIB

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: Robert Cogburn <rcogburn@...>
Date: Fri, 30 Oct 1998 14:43:13 -0700
>There seems to be a lot of LIBs available, and this one may be of use to
>FBers that work with Random Numbers. How you shoe horn it into FB I don't
>know or even if it can be.
>
>So for the ones in the know, are these libs useful or merely encouragment
>to seek a new language?
>
>Mel

There is a good article on this in MacTech, the October 1998 current 
issue. Most "[pseudo] random number generators" are only that in name, 
and fail in many ways to generate a sequence of numbers meeting the 
necessary statistical properties of a random sequence. The most famous 
example is a generator most everyone used in the 70's called RANDU. It 
fails so badly that it has become the prime example of how not to do it. 

Any random number generator, even RANDU, will likely give a good uniform 
distribution of the values it generates, so if for example it is set to 
generate integers between 1 and 100, then in a long run each integer will 
appear about 1% of the time. That's easy. The hard part is to get 
successive values without any hidden ties to how they behave, that is to 
get "independent values". The URandomLib uses the "Ultra" generator 
algorithm. It has been tested extensively and appears to do very well in 
this regard, while most generators fail badly.

Another issue is the period. Eventually any programmed random number 
generator will cycle back to its starting seed, then simply repeat itself 
endlessly. Some generators can have very short periods for certain 
choices of the initial seed. In any case if they are based on a long 
integer value the period cannot be longer than 2^32. By contrast the 
Ultra generator achieves a period of about 10^366. For all practical 
purposes it will never recycle.

I know if you need random numbers only to occasionally choose one of n 
items, these issues will seem pretty esoteric, but for those of us who 
use them to simulate stochastic processes such as turbulence, Brownian 
motion and stuff like that they are essential.

All the best, 

     Robert