Our Mathematical Selection code in Visual Basic.
Mathematical Selection Class File:
Public Class Selection
    Public words As String()
    Public r As Integer ' min length Of word
    Protected complete_group
    Private i As Integer
    Public Function groupSelection(candidates As String(), size As Integer) As List(Of String())
        words = candidates
        r = size
        complete_group = New List(Of String())
        i = 0
        recursiveFillUp(New List(Of String))
        Return complete_group
    End Function
    ' pick elements recursively
    Protected Sub recursiveFillUp(temp As List(Of String))
        Dim picked_elements(words.Length) As List(Of String)
        Dim j As Integer = i
        Do While j < words.Length
            picked_elements(j) = New List(Of String)
            picked_elements(j).AddRange(temp)
            picked_elements(j).Add(words(j))
            ' recoil factor
            If i >= words.Length Then
                i = j
            End If
            ' satisfied yet?
            If picked_elements(j).Count = r Then
                complete_group.Add(picked_elements(j).ToArray())
            ElseIf picked_elements(j).Count < r Then
                recursiveFillUp(picked_elements(j))
            End If
            j += 1
        Loop
        j -= 1
        If picked_elements(j).Equals(Nothing) = False And picked_elements(j).Count = r Then
            i += 1 ' keep recoil factor straightened out
        End If
    End Sub
End ClassMain Class:
Module Miscellaneous_Selection
    Sub Main()
        Dim goods As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
        Dim pick As New Selection
        Dim result As List(Of String()) = pick.groupSelection(goods, 2)
        ' print choices and operation
        Console.Write("[ ")
        For Each choice As String In pick.words
            Console.Write(choice & "; ")
        Next
        Console.WriteLine("] selection " & pick.r & ":" & Environment.NewLine)
        ' print out selections nicely
        Dim i = 0
        For Each group As String() In result
            i += 1
            Console.Write(i & ": ")
            For Each member As String In group
                Console.Write(member & "; ")
            Next
            Console.WriteLine()
        Next
        Console.WriteLine(Environment.NewLine & "Number of ways is " & result.Count & ".")
    End Sub
End ModuleTry it out!
                            
                                
                                
                                
                                Elegance (0.0)
                                
                                
                                
                            
                        
                
        
            
            
        