Re: Random number generator without duplicates?
Re: Random number generator without duplicates?
- Subject: Re: Random number generator without duplicates?
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 17 Apr 2001 09:33:43 -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.
property numberList : {1}
if numberList = {1} then -- only do this once
repeat 55 times
set x to last item of numberList
set end of numberList to (x + 1)
end repeat
end if
set randomList to {}
repeat 6 times
set check to false
repeat until check is true
set y to some item of numberList
if {y} is not in randomList then
set end of randomList to y
set check to true
end if
end repeat
end repeat
randomList
--
Paul Berkowitz