Random code

Becca
07-21-2003, 12:18 AM
Hi,

I was wondering if anyone could help me. I've been looking through websites for a snatch of random code, that say, pulls 10 random numbers from 1000, and stores them in a listbox. My problem is that I just keep getting websites with advertisements that keep popping up, and I'm very frustrated. Would anyone please be able to help me, if they have just a small snippet of code that does that?

Any help is appreciated!
Thankyou! :D

PWNettle
07-21-2003, 12:47 AM
Populate a listbox with 10 random numbers 1-1000.

Dim nIndex As Integer

Randomize ' Seed the random number generator.

For nIndex = 1 To 10
List1.AddItem Int(Rnd * 1000) + 1
Next nIndex

There are some resources at this site (in the Tutor's Corner and Code Library forums) if you would like more information on generating random numbers.

Paul

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum