Skip to content

Commit

Permalink
Merge pull request dankogai#39 from battila7/master
Browse files Browse the repository at this point in the history
Permutation fix for 31 elements or more - closes dankogai#34
  • Loading branch information
dankogai authored Feb 2, 2017
2 parents 31069ba + 243b3ff commit 66e0087
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion combinatorics.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,13 @@
return size;
},
init: function() {
this.cmb = combination(ary, nelem);
/* combination can only be used for less than 31 elements */
if (ary.length < 31) {
this.cmb = combination(ary, nelem);
} else {
this.cmb = bigCombination(ary, nelem);
}

this.per = _permutation(this.cmb.next());
},
next: function() {
Expand Down

0 comments on commit 66e0087

Please sign in to comment.