Re: Random number generator without duplicates?
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