Code Question
Code Question
Code Question
Code Question
Code Question
Code Question Code Question Code Question Code Question Code Question Code Question Code Question Code Question
Code Question Code Question
Code Question
Go Back  Xtreme Visual Basic Talk > > > Code Question


Reply
 
Thread Tools Display Modes
  #21  
Old 08-14-2005, 05:27 PM
Iceplug's Avatar
IceplugCode Question Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default


Well, what's probably happening is that, when you roll a 6, the code runs through the procedure doing nothing and so you have to click the button again before you actually get a 2, 3, 4, or a 5. So, when you run your program, click the button and, if nothing appears to happen when you click it one time, then I told you so .

Better yet, a messagebox to show the value of random after you generate it might help also.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #22  
Old 08-14-2005, 11:28 PM
Dilbert0014 Dilbert0014 is offline
Freshman
 
Join Date: Aug 2005
Posts: 27
Default

So. I set the CInt as 2 to 5. I can roll 2,3,4,5,6. Okay, that's wierd. Does that mean with the line with 2 to 5 I can also roll a "1"?
Reply With Quote
  #23  
Old 08-15-2005, 07:23 AM
Iceplug's Avatar
IceplugCode Question Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

No, the 2 is the lowest number that you can get, and the 5 is number of unique numbers that you will get.

Or, you can say that 2 is the lowest number, and the highest number is (5 + 2 - 1) 6.


Random Numbers
Random Number Tutorial since you are using the legacy functions.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!

Last edited by Iceplug; 08-15-2005 at 07:31 AM.
Reply With Quote
  #24  
Old 08-15-2005, 10:05 PM
Dilbert0014 Dilbert0014 is offline
Freshman
 
Join Date: Aug 2005
Posts: 27
Default

Oh, okay. So "Low" equals lowest number, and "high" equals how many numbers. I get it. Thanks!
Reply With Quote
  #25  
Old 08-16-2005, 06:47 AM
Iceplug's Avatar
IceplugCode Question Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

No no...
Int(Howmany * Rnd + Low)
in this case, Howmany would be how many numbers and Low means lowest number.

Int((High - Low + 1) * Rnd + Low)
in this case, High is the highest number, and Low is the lowest number.

__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #26  
Old 08-18-2005, 04:17 PM
Dilbert0014 Dilbert0014 is offline
Freshman
 
Join Date: Aug 2005
Posts: 27
Default

Bleh! I'm such a... newbie!!!

Thanks. I got it now.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Code Question
Code Question
Code Question Code Question
Code Question
Code Question
Code Question Code Question Code Question Code Question Code Question Code Question Code Question
Code Question
Code Question
 
Code Question
Code Question
 
-->