[comp.sys.mac.hypercard] Initializing the random number generator

aperez@cvbnet.UUCP (Arturo Perez x6739) (12/13/90)

How is that thing initialized?

Arturo Perez
ComputerVision, a division of Prime
aperez@cvbnet.prime.com
Too much information, like a bullet through my brain -- The Police

Nielsen_AD@cc.curtin.edu.au (12/29/90)

Regarding the random number generator in HyperCard 2.0:

In article <1154@cvbnetPrime.COM>, aperez@cvbnet.UUCP (Arturo Perez x6739) writes:
> How is that thing initialized?

That is a good question.  The random number function seems to continuously
generate the number "1".  This doesn't seem terribly random to me...
Can the HyperCard team please comment on whether this is a bug, or if
it is something we're doing wrong, like not "initialising" the random number
generator before using it?

Many thanks.

_______________________________________________________________________________
Andrew D. Nielsen         ACSnet  : Nielsen_AD@cc.cut.oz.au
Programmer                Internet: Nielsen_AD@cc.curtin.edu.au
School of Physiotherapy   Bitnet  : Nielsen_AD%cc.curtin.edu.au@cunyvm.bitnet
Curtin University         PSImail : psi%050529452300030::Nielsen_AD
Selby St                  UUCP    : uunet!munnari.oz!cc.curtin.edu.au!TNIELSENA
Shenton Park WA 6008      Tel     : +61 9 381 0600
AUSTRALIA                 FAX     : +61 9 381 1496
_______________________________________________________________________________

smelly@polari.UUCP (Tom Benedict) (01/01/91)

Regarding the random function in HyperCard.  Are you sure your calling
random with the proper argument?  I haven't had any problems getting
random number in my script or directly from the msg box.
random(5) generates a random number between 1 and 5 etc...
I didn't notice any problem under HC2.0 or 2.0v2.  
Good luck
Tom Benedict

aperez@cvbnet.UUCP (Arturo Perez x6739) (01/03/91)

From article <3047@polari.UUCP>, by smelly@polari.UUCP (Tom Benedict):
> 
> Regarding the random function in HyperCard.  Are you sure your calling
> random with the proper argument?  I haven't had any problems getting
> random number in my script or directly from the msg box.
> random(5) generates a random number between 1 and 5 etc...
> I didn't notice any problem under HC2.0 or 2.0v2.  
> Good luck
> Tom Benedict

Well, the problem is
	I always get the same sequence of random numbers

Now, for testing purposes, you want to be able to ensure that you get
the same sequence of numbers every time.  But once a program is debugged
then you have to set the sequence to something "random" every time it's
started; like with the time, for example.

So, how do I stop the random number generator from
giving me that same sequence over and over again?

Arturo Perez
ComputerVision, a division of Prime
aperez@cvbnet.prime.com
Too much information, like a bullet through my brain -- The Police

Nielsen_AD@cc.curtin.edu.au (01/03/91)

In article <3047@polari.UUCP>, smelly@polari.UUCP (Tom Benedict) writes:
> 
> Regarding the random function in HyperCard.  Are you sure your calling
> random with the proper argument?  I haven't had any problems getting
> random number in my script or directly from the msg box.
> random(5) generates a random number between 1 and 5 etc...
> I didn't notice any problem under HC2.0 or 2.0v2.  
> Good luck
> Tom Benedict
-- 

Well, it turns out that the problem was with the SANE Traps feature of
the cache card (Total Systems Integration) installed on my Macintosh IIci.
When switched on, it causes HyperCard to give a "random" value of 1, when
switched off, everything's fine again.

Regards,

Andrew.