• 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: Chris Nebel <email@hidden>
  • Date: Tue, 17 Apr 2001 13:40:36 -0700
  • Organization: Apple Computer, Inc.

Bryan Harris wrote:

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

There is no such rule. If the generator reliably spat out every number from 1 to
n in just n iterations, it wouldn't really be random. That said, there are
problems in 1.5.5 and 1.6 with random integers coming out with different
frequencies. The endpoints (in this case, 1 and 56) tend to turn up out of
proportion to the others.

--Chris Nebel
AppleScript Engineering


  • Prev by Date: Scripting Graphic Converter batch droplet
  • Next by Date: Re: Random number generator without duplicates?
  • Previous by thread: Re: Random number generator without duplicates?
  • Next by thread: Re: Random number generator without duplicates?
  • Index(es):
    • Date
    • Thread