Randomizing a Sequence of Numbers

Robse
05-12-2003, 09:03 AM
I've seen some posts where people need to generate an array with
unique random numbers. The standard method where you just test if a new
random number already exists in the array, has some drawbacks, it's
slow and you never know how long it'll take. A better way is to draw
numbers randomly out of a pool of numbers, and then flag those numbers
as already taken and thus narrow the pool down gradually.

This small routine does this, but instead of using another boolean array
where the numbers get flagged, I've used a collection, to let VB handle
the removing etc... of the numbers.

Hope it gives some people new ideas...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum