• Log in or sign up for an account here: https://www.sythe.org/login

random number help

superman1478

Apprentice
Joined
Jan 21, 2007
Sythe Gold
0
Messages
701
Age
35
Location
U.S.A
This code is what i'm using to display a random number for my auto alcher. Someone suggested that i have it display numbers with decimals,and i cant seem to get it to do that.

Code:
Private Sub Timer1_Timer()
Randomize
text1.Text = Int(Rnd * (6 - 2 + 1) + 2)
End Sub

How do i have this display decimals, not just whole numbers?
 
One thing, instead of 6 - 2 + 1 why not just 5? It is inside () so it would be the same as rnd * (5) + 2

edit: instead of using a whole number try like 5.3235 or something...
 
One thing, instead of 6 - 2 + 1 why not just 5? It is inside () so it would be the same as rnd * (5) + 2

edit: instead of using a whole number try like 5.3235 or something...

The reason i have the +1 there is because is place of the 6 i have cmdinterval.text.

I have tried doing things like

Code:
Text1.Text = Int(Rnd * (6.3235 - 2.505 + 1) + 2.505)
 
Well using Int changes it to a whole number.. so just remove int. If you need, you can find a different function that won't remove the decimal.
 
Runescape Gamblingrunescape gambling
Back
Top