• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about random number on AS 1.5.5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about random number on AS 1.5.5


  • Subject: Re: Question about random number on AS 1.5.5
  • From: Bryan Harris <email@hidden>
  • Date: Sat, 24 Feb 2001 19:49:51 -0600

If you need the seed to be different every time, do what the old Apple IIs
did... Use the current seconds on the system as the seed.

set ranNum to random number with seed (time of (current date))

(Obviously if you use this more than once per second you'll get the same
number.)

- Bryan



> 1) I turn off my PowerBook every night, and start it again
> the next morning. All the scripts that use the random number
> are working correctly. However, it seems that each day the random
> numbers are started from the same seed. In other words,
> I seem to be generating the same sequence of random numbers
> each time I turn on the PowerBook.
>
> 2) After reading the Standard Additions manual on the subject of
> "random number", it is my understanding that if I use
>
> random number with seed 0
>
> a random number based on an independent seed is generated.
> But, at least in my case, whenever I use "with seed 0" I always
> generate the same random number. Maybe I'm understanding the
> manual incorrectly?
>
> I have "solved" problem (1) by first generating a random number
> with HyperTalk, and then using this number as a seed in a 1-line AS
> that I run first thing every morning. But I wonder if there
> could be something wrong with my machine or Scripting Additions
> or perhaps something else.


References: 
 >Question about random number on AS 1.5.5 (From: "Fernando O. Raineri" <email@hidden>)

  • Prev by Date: Re: Question about random number on AS 1.5.5
  • Next by Date: Re: Question about random number on AS 1.5.5
  • Previous by thread: Question about random number on AS 1.5.5
  • Next by thread: Re: Question about random number on AS 1.5.5
  • Index(es):
    • Date
    • Thread