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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

random limit

Status
Not open for further replies.

cjkenworthy

Programmer
Sep 13, 2002
237
GB
I am generating random numbers:

dim upper_limit
upper_limit = 150

Randomize
dim varRandomNumber
varRandomNumber = Int(Rnd * 14) + 1

i.e. a random integer between 1 and 14 - is there a better way of doing this BUT to limit the random number to a range of 1 up to: an upper limit of the variable "upper_limit"

Chris
 
dim upper_limit
upper_limit = 150

Randomize
dim varRandomNumber
varRandomNumber = Int(Rnd * upper_limit) + 1


Are you looking for an array of random numbers? See thread222-405021. -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top