Random algorithm

Mark Brownell gizmotron at earthlink.net
Wed Nov 12 12:46:37 EST 2008


I'm surprised that the random seed was not mentioned. Please excuse this if someone has responded with that. I'm on digest mode.

I've solved the random RNG problem by simulating the function of the Roulette wheel. This idea of using random bits or like some websites do it is the clue. When Revolution starts up it sets a new random seed and uses that same seed until the application shuts down. If you reset the random seed for each spin, like on a roulette wheel, then you can combine several things that must happen before the ball lands in a single slot. You can randomize the spin speed, the wheel speed, the track resistance, the bumper strike positions or misses, and the slot fin strikes or misses. In this way, by combining several random conditions you can do as well as any accepted form of so called true randomness.

So I would stack about five different conditions that include millions of possibilities and use that to randomize the final outcome. I would always set a new random seed before starting.

My two cents,

another; Mark

>
>Message: 8
>Date: Tue, 11 Nov 2008 22:16:18 +0100
>From: Jacques Hausser <Jacques.Hausser at unil.ch>
>Subject: Random algorithm
>Hi,
>
>Does somebody know which algorithm is hidden behind the random  
>function ? Native random number generators have usually a poor  
>reputation, and I need trustable random numbers. I have translated the  
>Mersenne twister algorithm which works OK, but slowly (47 milliseconds  
>for 1000 numbers against five for the random function). If the native  
>function is a good one, I'll keep it...
>
>Thanks for any hint
>
>Jacques




More information about the use-livecode mailing list