Re: Random number generator without duplicates?
Re: Random number generator without duplicates?
- Subject: Re: Random number generator without duplicates?
- From: Doug McNutt <email@hidden>
- Date: Tue, 17 Apr 2001 11:00:32 -0600
>
How can I get a list of random numbers that does not include any duplicates?
The buzzword for searching is "shuffling". There was an article in Dr. Dobbs Journal about a year ago. You start with an indexed array of integers from 1 to N and move them around at random. It makes a difference whether or not you allow an individual element - a card - to be moved twice. I have a MacPerl script which I have been meaning to update to the Dr. Dobbs recommendations but it works now. if you'd like it - ask.
AppleScript? I don't even know how to typedef an array let alone work with pointers to the elements.
--
-> From the U S of A, the only socialist country that refuses to admit it. <-