Description
Random function is a function that is used to generate a random value.for a programmer is very useful random value that can be used to create a combination of string with random numbers that can produce a value to blur or protect the original value.
Not only that, a random number can be implemented in a variety of applications, for example randomize the order list of songs like winamp, then for animations contained in the application like "count down application" or even to generate some random string for security purpose like in oauth.
but for this case, i just make a random number function not random string !!.
How To
Private Function getRandomRange(ByVal lower As Integer, ByVal upper As Integer) Dim randomValue Dim objRandom As New Random randomValue = objRandom .Next(lower, upper) Return randomValue End Function
to use this function within range just call this function like this :
- i want random number between number 1 - 9
so in VB.NET like this
* msgbox(getRandomRange(1,10)).
the question why 10 ? not 9 ? because in VB.NET upper number (in this case is 10) is not issued only 1 - 9.
Post a Comment
Harap gunakan bahasa yang baik dan sopan, terima kasih