> I'd like to build a non repeating random, something like, it
> randomize the numbers but don't repeat them

You can do this a few ways - generate the complete list & then randomize it,
or check each element against the current contents before adding it. Here's
a simple way:


on buildNonRepeatingRandomList ofHowManyElements
  ls = []
  repeat while ls.count < ofHowManyElements
    rand = random( ofHowManyElements )
    if not( ls.getOne( rand )) then
      ls.add( rand )
    end if
  end repeat
  
  return ls
end


Is this what you're wanting?  Hope it helps.

/*********************************
* Rob Wingate, Software Human    *
* http://www.vingage.com         *
* mailto:[EMAIL PROTECTED] *
*********************************/

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to