View Single Post
Old Apr 30th, 2008, 6:11 PM   #12
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,034
Rep Power: 5 lectricpharaoh will become famous soon enough
Re: populate array with random nonrepeating #'s

This topic was discussed not too long ago in this thread. In post #8, I offered a solution using generics that will shuffle an array. Thus, you can easily create a 42-element array, initialize each element (inside a for() loop), and then hand the array off to be shuffled. This guarantees each value will appear once, and only once, within the array.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote