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

Salvador Garcia salvadorgarciav at yahoo.com
Fri May 19 12:57:11 EDT 2017


Thanks all, much appreciated. Salvador



      From: Arthur Flexser <flexser at fiu.edu>
 To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com> 
 Sent: Friday, May 19, 2017 11:14 AM
 Subject: Re: [Coco] Is the RND command really generating a random number?
   
RND(TIMER) will just give a random number between 0 and whatever the
current value of TIMER is.  RND with a negative argument will reseed the
random number generator, starting the upcoming sequence of random numbers
in a different place than where it would ordinarily start.  RND(-TIMER)
makes the seed dependent on the TIMER value, so you'd get a different
sequence of pseudo-random numbers each time you run the program.
RND(TIMER) will only affect the scaling of the current random number to
make it within the required interval, but won't affect the underlying
sequence of numbers generated.

Art

On Fri, May 19, 2017 at 11:10 AM, Salvador Garcia via Coco <
coco at maltedmedia.com> wrote:

> 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
>
>
>
>
> --
> 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