CombinatoricsGenerate |
Name | Description | |
---|---|---|
GenerateVariation(BigInteger, Int32, Random) |
Generate a random variation, without repetition, by randomly selecting k of n elements with order. This is an O(k) space-complexity implementation optimized for very large N. The space complexity of Fisher-Yates Shuffling is O(n+k). When N is very large, the algorithm will be unexecutable in limited memory, and a more memory-efficient algorithm is needed. You can explicitly cast N to BigInteger if N is out of range of Int32 or memory, so that this special implementation is called. However, this implementation is slower than Fisher-Yates Shuffling: don't call it if time is more critical than space. The K of type BigInteger seems impossible, because the returned array is of size K and must all be stored in memory. | |
GenerateVariation(Int32, Int32, Random) | Generate a random variation, without repetition, by randomly selecting k of n elements with order. Implemented using partial Fisher-Yates Shuffling. |