• 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: Michelle Steiner <email@hidden>
  • Date: Tue, 17 Apr 2001 09:31:56 -0700

On 4/17/01 6:54 AM, email@hidden <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.

global numberHolder
set the numberHolder to {}

repeat 6 times
GenerateRandom()
end repeat

to GenerateRandom()
set temp to random number from 1 to 57
if temp is in numberHolder then
GenerateRandom()
else
set numberHolder to numberHolder & temp
end if
end GenerateRandom

----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------


  • Prev by Date: Re: zapping gremlins
  • 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