Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Number Generator 1

Status
Not open for further replies.

BDW1969

IS-IT--Management
Aug 29, 2002
43
US
Does anyone have a code sample for a random number generator? It would be most useful.
 
I use the following I set a lower and Upper value and the return falls within the range of the two.

Public Sub RandomData()
Dim RandomValue as Integer

RandomValue = Int((UpperBound - LowerBound + 1) * Rnd() + LowerBound)

End Sup

"Shoot Me! Shoot Me NOW!!!"
- Daffy Duck
 
Thanks for the quikck response
 
How about this:

Dim GeneratorRandom as new Random
Dim intNum as integer
'generate a random number between 1 and 100
intNum = GeneratorRandom.Next(1,100)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top