|
-
Jul 9th, 2001, 01:18 AM
#1
Need the simple Random code
Hey, I need the simple Random function.
Can ne post it for me?
tnx
-
Jul 9th, 2001, 01:38 AM
#2
-= B u g S l a y e r =-
MSDN :
To produce random integers in a given range, use this formula:
Code:
Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range.
something like that ?
-
Jul 9th, 2001, 01:48 AM
#3
Registered User
To get you started:
VB Code:
Private Function Random(ByVal Min As integer, ByVal Max As integer) As Integer
Randomize
Random = Int((max - min + 1) * Rnd + min)
End Function
-
Jul 9th, 2001, 01:50 AM
#4
No, I mean something like get a random number between 1 to 10...
?
-
Jul 9th, 2001, 01:54 AM
#5
Hyperactive Member
Randomize
int((10-1+1)*rnd+1)
===========================
Kourosh Gonabadi
VB Programmer 
C++ Newbie 
Graphic Designer
===========================
-
Jul 9th, 2001, 02:09 AM
#6
VB Code:
Private Sub Command1_Click()
Randomize Timer
Msgbox Int((Rnd * 10) + 1)
End Sub
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
|