Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function callManyTimes(minIndices, maxIndices, func) {
- doCallManyTimes(minIndices, maxIndices, func, [], 0);
- }
- function doCallManyTimes(minIndices, maxIndices, func, args, index) {
- if (maxIndices.length == 0) {
- func(args);
- } else {
- var restMin = minIndices.slice(1);
- var restMax = maxIndices.slice(1);
- for (args[index] = minIndices[0]; args[index] < maxIndices[0]; ++args[index]) {
- doCallManyTimes(restMin, restMax, func, args, index + 1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement