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

Mathieu Bouchard matju at artengine.ca
Fri May 19 10:13:10 EDT 2017


Actually, I'm not sure that my experiment was really about QuickBASIC's RND(). 
Now I remember that RND() was annoyingly slow and I tried writing my own 
generator. The simplest textbook examples of such generators caused the visual 
patterns I described, and I think RND() was already better than that. I wrote 
that about 22 years ago and I haven't retried since.


Le 2017-05-19 à 10:00:00, Mathieu Bouchard a écrit :

> "Truly random" is hard to define, if not hardly definable. It's at least as 
> hard to test. What we dare call "truly random" is merely what we have no clue 
> about. Of course, RNGs have various degrees of ability to "appear random" 
> (whatever that means). In the case of BASIC, even if you seed the RNG with a 
> realtime clock, the algorithm can still suck in different ways, such as how 
> likely it is to produce a number after another given one. I remember an 
> experiment I made in QuickBASIC with RND() producing numbers from 0 to 65535 
> inclusively. I divided them by 256, plotted the floor of the quotient as y, 
> and the remainder as x. Various temporary visual patterns appeared (such as 
> dotted diagonal lines). This 256x256 square also got filled completely much 
> quickly than according to probability theory. With slight variants of the 
> same (linear-congruential) algorithm, theoretical randomness can be faked a 
> lot better than RND(), but that's not what Microsoft chose to use.
>
>
> Le 2017-05-18 à 19:44:00, Dave Philipsen a écrit :
>
>> Very few things in the computer world are truly random.  A better term 
>> might be 'pseudo-random'.  Think about it.  In theory if you turn on two 
>> identical CoCos at the same time and ask for a random number at the same 
>> time they should both provide the same random number.  So, in reality, it's 
>> not random.
>> 
>> Dave
>> 
>> On 5/18/2017 7: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
>
> ______________________________________________________________________
> | Mathieu BOUCHARD --- tél: 514.623.3801, 514.383.3801 --- Montréal, QC
>

  ______________________________________________________________________
| Mathieu BOUCHARD --- tél: 514.623.3801, 514.383.3801 --- Montréal, QC


More information about the Coco mailing list