Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Combinatorics – a Processing library for combinations, variations, permutations
JavaScript Processing Java
Tree: 88f667cda9

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


 Combinatorics library for the Processings

 This library provides an easy way to generate combinations, variations and 
 permutations from a given set of values.

 Current release is now compatible with JavaScript mode in Processing 2.0


 Please use the zip under Downloads until Processing 2.0 has been released.



 Combinatorics library provides iterators for these combinatorical sets:
 – Combinations
 – CombinationSets
 – Variations
 – VariationSets
 – Permutations
 The iterators provide arrays of indices (addresses) into an imaginary 
 array of a given length at each step. These adresses can then be used 
 on any kind of real array. Example needed, so ..
 Say you have a String array:
 { "A", "B", "C" }
 ... and you'd like to find all possible combinations at any length.
 A CombinationSet would return these indice arrays:
 []                       empty (0 elements)
 [0], [1], [2]            combinations of 1 element
 [0, 1], [0, 2], [1, 2]   combinations of 2 elements
 [0, 1, 2]                combinations of 3 elements
 Using these indices to read from your array would give you:
 ["A"], ["B"], ["C"]
 ["A", "B"], ["A", "C"], ["B", "C"]
 ["A", "B", "C"]
 A quick class overview:
 Combination      unique combinations, no duplications, order is ignored
 CombinationSet   range of combinations at different lengths
 Variation        all possible variations, includes duplication, order matters
 VariationSet     range of variations at different lengths
 Permutation      all possible ways to order the elements, no duplications


 Props, Thank-you's
 The Java (and JavaScript) code for permutation is based on code by Michael Gillelands 
 (at, which he claims to be an implementation of
 Kenneth H. Rosen, Discrete Mathematics and Its Applications, 
 2nd edition (NY: McGraw-Hill, 1991), pp. 282-284

 BigInteger (in JavaScript version) was written by John Tobey and Matthew Crumley
 and is available at and
Something went wrong with that request. Please try again.