- Home
- Premium Memberships
- Lottery Results
- Forums
- Predictions
- Lottery Post Videos
- News
- Search Drawings
- Search Lottery Post
- Lottery Systems
- Lottery Charts
- Lottery Wheels
- Worldwide Jackpots
- Quick Picks
- On This Day in History
- Blogs
- Online Games
- Premium Features
- Contact Us
- Whitelist Lottery Post
- Rules
- Lottery Book Store
- Lottery Post Gift Shop
The time is now 12:44 am
You last visited
April 18, 2024, 10:42 pm
All times shown are
Eastern Time (GMT-5:00)
A Better Random Comb.
Published:
Updated:
Function RandComb(ByVal N As Integer, ByVal R As Integer) As String
Dim vs As Integer 'Value Selection
Dim v(99) As Integer 'Values Array
Dim s(99) As Boolean 'Sorted Selected Values Array
Dim temp As String 'Temporary String Storeage
temp = "" 'Initialize Temporary String
'Initialize Arrays
For a = 0 To 99
v(a) = a
s(a) = False
Next
'Select R of N values
For a = 1 To R
vs = Int(Rnd * (N - a + 1)) + 1 'Randomly select a value from 1 to N of any remaining values less by previous selections
s(v(vs)) = True 'Set sorted select value array
'Shift to lower array positions those values greater than the current randomly selected value
For b = 1 To N - a
If b >= vs Then
v(b) = v(b + 1)
End If
Next
Next
'Add in order the selected values
For a = 1 To 99
If (s(a)) Then temp = temp + Format(a, "00 ")
Next
'Return the selected R of N values
RandComb = temp
End Function
Comments
This Blog entry currently has no comments.
Post a Comment
Please Log In
To use this feature you must be logged into your Lottery Post account.
Not a member yet?
If you don't yet have a Lottery Post account, it's simple and free to create one! Just tap the Register button and after a quick process you'll be part of our lottery community.
Register