Jump to content
  • Advertisement

Archived

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

Twisted Puppet

making a random number appear in a label

This topic is 5616 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

Advertisement
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
Or in in the Form_Load() procedure you could just put Randomize Timer. They both work though, up to you

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!