• 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: Nigel Smith <email@hidden>
  • Date: Tue, 17 Apr 2001 17:42:11 +0100

Garry 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.

How's about (though I'm sure someone will come up with something better!)
________________
set myList to {0}
set x to 0
repeat until length of myList = 7
repeat until x is not in myList
set x to random number from 1 to 56 with seed current date
as string
end repeat
copy x to end of myList
end repeat
return rest of myList
________________


Later,

Nigel


References: 
 >Random number generator without duplicates? (From: email@hidden)

  • 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