Archived

This topic is now archived and is closed to further replies.

making a random number appear in a label

This topic is 5309 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
quote:

it is C++, I am using "Microsoft Visual Basic 6.0" any help?



WTF?

Share this post


Link to post
Share on other sites
Dim iUpper As Integer
Dim iLower As Integer

iUpper = 5
iLower = 1

iRoll = Int((iUpper - iLower + 1) * Rnd + iLower)

labelname.caption = iRoll


That should work. Been awhile since I did that in VB though

~"What''''s this red button do?"

Share this post


Link to post
Share on other sites
One more thing I forgot to add. You have to put Randomize before the line where you are using Rnd if you plan on using this more than once. (IE, generating random damage or whatever).

[edited by - Psyberia on June 4, 2003 9:31:22 PM]

Share this post


Link to post
Share on other sites