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

Salvador Garcia salvadorgarciav at yahoo.com
Fri May 19 11:10:54 EDT 2017


Why won't RND(TIMER) work?

Thanks, Salvador

      From: Arthur Flexser <flexser at fiu.edu>
 To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com> 
 Sent: Thursday, May 18, 2017 11:26 PM
 Subject: Re: [Coco] Is the RND command really generating a random number?
   
RND(TIMER) will not work for seeding the random number generator.  It has
to be RND(-TIMER) with a minus sign.

Art

On Thu, May 18, 2017 at 10:52 PM, Bruce W. Calkins <
brucewcalkins at charter.net> wrote:

> 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.
>>
>>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>

-- 
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco


   


More information about the Coco mailing list