Rdm (Random) number duplication (Access XP)?

R

RioDeSmoke

I have some code that loops through a Recordset in order to select an X
amount of random records. When I select 10 records I get 10 -- 20 I get 20
and so on. But, when I select 400, I get 369 at times and 381 at others.
The difference gets greater the more records I select. I believe what is
happening is that the random numbers being generated are being duplicated and
it can't select the record more than once. Here is my code within my loop:

MyRS.MoveLast
NumOfRecords = MyRS.RecordCount
Randomize
SpecificRecord = Int((NumOfRecords * Rnd) + 1)

Has anyone ever seen this? Please help if you can this is driving me crazy!
 

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