• 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: Random number generator without duplicates?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random number generator without duplicates?


  • Subject: Re: Random number generator without duplicates?
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 17 Apr 2001 12:24:41 -0700

On 4/17/01 11:34 AM, "Bryan Harris" <email@hidden> wrote:

>> How can I get a list of random numbers that does not include any duplicates?
>> I would want to use these parameters: six random numbers from 1 to 56, as a
>> list or as six variables, no duplicate numbers.
>
>
> I notice after a few trials that the random number function is generating
> duplicates after only a few iterations.
>
> So just out of curiosity I generated 56 random numbers "from 1 to 56". Here
> are the results:
>
> * 39% (22) of the values were never generated
> * 28% of the values were generated once
> * 1 of the values was generated 4 times
>
> Isn't the integer random number generator supposed to follow the same rules
> as the real, i.e. generate every value once before repeating?
>
Chris Nebel has mentioned bugs with 'random number ' (which is on osax in
Scripting Additions, before. I can't remember the current state of affairs,
built that's why i generated a list of numbers 1 thru 546, then use the
'some' operator on it. No bugs I think. Super-fast, even first time when it
has to generate the list.

Bryan, I'd appreciate if you'd test in the same way on the script I sent
using 'some'.

--
Paul Berkowitz


  • Prev by Date: Best way to handle simultaneous AppleEvents?
  • Next by Date: Re: Naming Quark boxes - screwed up!
  • Previous by thread: Re: Random number generator without duplicates?
  • Next by thread: Re: Random number generator without duplicates?
  • Index(es):
    • Date
    • Thread