Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/simplestatistics/src/combinations_replacement.js>default

simple statistics for node & browser javascript
Latest
function default
import { default } from "https://deno.land/x/simplestatistics@v7.8.3/src/combinations_replacement.js";

Implementation of Combinations with replacement Combinations are unique subsets of a collection - in this case, k x from a collection at a time. 'With replacement' means that a given element can be chosen multiple times. Unlike permutation, order doesn't matter for combinations.

Examples

combinationsReplacement([1, 2], 2); // => [[1, 1], [1, 2], [2, 2]]

Parameters

x

any type of data

k

the number of objects in each group (without replacement)