mariofan12
2008-10-05 12:24:31
Yes visual basic does have functions like SCAR and it does return a result…
Well here's my random function
If you want to use it in your program, then paste this at the top of your code.
How to use:
Lets say you want to a label called "label1" to display a random number between 10 and 15 (so the range is 5 and the min is 10).
see how that works?
This can be used for many different things like case statements or games.
Well here's my random function
If you want to use it in your program, then paste this at the top of your code.
Public function Random(ByVal Range as integer, ByVal Min as integer) As Integer
Dim randomsin as single = Rnd() * Range 'Randomizes the single.
randomsin = randomsin + Min 'Will as the min you used to add to the random int.
return int(randomsin) 'Makes the single a whole number and returns it
End FunctionHow to use:
Lets say you want to a label called "label1" to display a random number between 10 and 15 (so the range is 5 and the min is 10).
label1.text = Random(5, 10)see how that works?
This can be used for many different things like case statements or games.