[Coco] Is the RND command really generating a random number?

Bruce W. Calkins brucewcalkins at charter.net
Thu May 18 22:52:18 EDT 2017


Short answer: No.

Longer answer: RND calls some sort of psudo-random lookup table. If you 
enter the table at the same point you will get the same sequence out.  
You need to "randomize" the entry point.  As someone mentioned one 
method is to add the command RND(timer) Which calls the current timer 
value, which is generally different each time, one is hard pressed to 
turn on their CoCo, load a program and run it in the same time repeatedly.

Bruce W.



On 05/18/2017 08:39 PM, Rietveld Rietveld wrote:
> I used the RND command to generate a random game play option in the cocoflash, but it doesn't seem to be very random. Some titles come up more than the laws of probability would suggest is possible.   instead I am now using a small math equation that uses a PEEK of the clock value.   This has resulted in a far more random looking selection
>
> Sent from my BlackBerry 10 smartphone.
>



More information about the Coco mailing list