Here's some sample code for using in VB6 that will let you calculate probabilities according to Combinations and Permutations formulas. Combinations tells you the number of ways you can pick items from a set when the order doesn't matter, and Permutations tells you the how many ways you can pick items from a set when order does matter.
I got the equations for combinations and permutations from https://www.mathsisfun.com/combinato...mutations.html and simply wrote them as VB6 code to get the functions I posted above.
Code:
Private Function Factorial(ByVal Value As Long) As Double
Dim n As Long
Factorial = 1
For n = 1 To Value
Factorial = Factorial * n
Next n
End Function
Private Function Permutations(ByVal ItemsToPick As Long, ByVal ItemsToPickFrom As Long, ByVal RepeatsAllowed As Boolean) As Double
If RepeatsAllowed Then
Permutations = ItemsToPickFrom ^ ItemsToPick
Else
Permutations = Factorial(ItemsToPickFrom) / Factorial(ItemsToPickFrom - ItemsToPick)
End If
End Function
Private Function Combinations(ByVal ItemsToPick As Long, ByVal ItemsToPickFrom As Long, ByVal RepeatsAllowed As Boolean) As Double
If RepeatsAllowed Then
Combinations = Factorial(ItemsToPickFrom + ItemsToPick - 1) / (Factorial(ItemsToPickFrom - 1) * Factorial(ItemsToPick))
Else
Combinations = Factorial(ItemsToPickFrom) / (Factorial(ItemsToPickFrom - ItemsToPick) * Factorial(ItemsToPick))
End If
End Function