How do I make a random number that displays... random numbers... from 1 to 10?
So I click a button and it says 8
I click it again and it says 3
Get it? How do I do that?
Printable View
How do I make a random number that displays... random numbers... from 1 to 10?
So I click a button and it says 8
I click it again and it says 3
Get it? How do I do that?
Create an instance of the Random class and use its Next method. Make sure you read the documentation first. Also make sure you only create one object and reuse it rather than creating a new object each time.
Hi 3dmaker,
try this:
VB Code:
Dim RND As New Random MessageBox.Show(RND.Next(0, 10))
Hope this helps...
Regards,
As I suggested, it is a good idea to read the doco. It should be Next(1, 11) to get a number from 1 to 10.
Ahaa...
I see! Thank you guys.
I will take a look at the documentation right now.
Thanks for the correction jmcilhinney ;)Quote:
Originally Posted by jmcilhinney
3dmaker as jmcilhinney said try to have a look @ the documentation, if you got what you want don't forget to resolve your thread :wave:
Regards,