|
-
Aug 5th, 2006, 09:23 PM
#1
Thread Starter
Hyperactive Member
[2005] Random number from 1 to 10
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?
-
Aug 5th, 2006, 09:53 PM
#2
Re: [2005] Random number from 1 to 10
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.
-
Aug 5th, 2006, 10:39 PM
#3
Addicted Member
Re: [2005] Random number from 1 to 10
Hi 3dmaker,
try this:
VB Code:
Dim RND As New Random
MessageBox.Show(RND.Next(0, 10))
Hope this helps...
Regards,
=======================================
If I helped you, Kindly Rate my post. Thanks
-----------
PHENOM 
-
Aug 5th, 2006, 11:33 PM
#4
Re: [2005] Random number from 1 to 10
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.
-
Aug 5th, 2006, 11:43 PM
#5
Thread Starter
Hyperactive Member
Re: [2005] Random number from 1 to 10
Ahaa...
I see! Thank you guys.
I will take a look at the documentation right now.
-
Aug 5th, 2006, 11:55 PM
#6
Addicted Member
Re: [2005] Random number from 1 to 10
 Originally Posted by jmcilhinney
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.
Thanks for the correction 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
Regards,
=======================================
If I helped you, Kindly Rate my post. Thanks
-----------
PHENOM 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|