Random Number Array

K

Ken Hudson

I have a variable number (RecordCount) and I want to select 15 random numbers
from it and stuff them into an array. I suspect the following code won't
preclude the possibility of getting repeat numbers. How do I insure that each
of the 15 numbers will be unique?

Opiton Explicit
Option Base 1
Dim Iloop as Double
Dim RecordCount as Double

For ILoop = 1 To 15
RndNo(ILoop) = Int((RecordCount * Rnd) + 1)
Next ILoop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top