| Combination Constructor (Int32, Int32) |
Initializes a new combination of
Rank 0
with the supplied number of
picks from the supplied number of
choices.
Namespace:
Kaos.Combinatorics
Assembly:
KaosCombinatorics (in KaosCombinatorics.dll) Version: 5.0.0.6
Syntax public Combination(
int choices,
int picks
)
Parameters
- choices
- Type: SystemInt32
Number of values to pick from. - picks
- Type: SystemInt32
Number of elements in the sequence.
Exceptions Remarks
Supplying a value for choices that is greater than picks
will instantiate a k-combination also known as a pick-combination.
Examples using System;
using Kaos.Combinatorics;
namespace ExampleApp
{
class CnExample01
{
static void Main()
{
var cn = new Combination (choices:6, picks:3);
Console.WriteLine ($"n={cn.Choices}, k={cn.Picks}:\n");
foreach (var row in cn.GetRows())
Console.WriteLine ($"{row.Rank,2}: {row}");
}
}
}
See Also