Click to See Complete Forum and Search --> : Random numbers


peachy
06-04-2004, 12:40 AM
Trying to take numbers 1 to 10 and randomly pick 5 unique numbers and put them in an array to use in my ASP

Here is what I got (in VBScript):
----
dim value, arTest(5)

for k = 0 to UBound (arTest)
Randomize
value = Int(Rnd * 10) + 1

arTest(k) = value
next
-------

Works but they are not unique!


If this is a copy of a post please forgive, thought I clicked on Post but can't find it so maybe I cleared instead. See I'm losing my mind over this project!

:confused:

buntine
06-04-2004, 01:06 AM
Try placing the Randomize statement above your for loop.

peachy
06-04-2004, 09:56 AM
They still are not all unique.:confused: