i am trying to create an array that consists of 15 random but unique numbers. any help is appreciated. i am using vb.net 2005.
thanks!
Printable View
i am trying to create an array that consists of 15 random but unique numbers. any help is appreciated. i am using vb.net 2005.
thanks!
Which part do you need help with:
- Declaring a 15-element array?
- Generating a random number?
- Ensuring that the number is not already in the array?
ensuring that the number is not already in the array.
I would probably use a Hashtable (System.Collections namespace). You can use the .Contains method to determine whether a value is already present and the .CopyTo method to copy it to an array when you have 15 unique values.
thanks phil i will work on this.