CodeItBetter Programming Another VB Programming Blog

How to generate a random number, in between two given values.

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
'Math - How to generate a random number, in between two given values.
'S = smallest number that it could return
'L = largest number that it could return

Option Explicit
 
Private Function Random(ByVal S As Long, ByVal L As Long) As Long
    Random = CLng(Rnd * (L - S + 1)) + S)
End Function

Related posts:

  1. How to generate Random Lotto Numbers
  2. How to generate random numbers, with the info
  3. How to return the smallest parameter value.
  4. How to return the biggest parameter value.
  5. How to Generate a standard windows About box
  6. Visual Basic 2008 – Random Number Generator
  7. How to generate list in combobox with all dates of current month
  8. How to sort a list of random numbers in List box at run time
  9. How to use InputBox function and get values
  10. How to find the receprocal of a given number

Filed under: Math Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.