Created
May 16, 2019 04:05
-
-
Save trandaison/8c2a2c527aa1bea02b6aa73d100f4300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateArrays = (limit = 600, arraySize = 36, min = 1, max = 99) => { | |
let currentIndex = max - arraySize + 2; | |
const result = []; | |
while (result.length < limit) { | |
const initArray = [null]; | |
const nextIndex = currentIndex + (arraySize - 1); | |
for (let i = currentIndex; i <= nextIndex; i++) { | |
initArray.push(i); | |
} | |
for (let i = min; i < currentIndex; i++) { | |
const array = [...initArray]; | |
array[0] = i; | |
if (result.length < limit) { | |
result.push(array); | |
} | |
} | |
currentIndex -= 1; | |
} | |
return result; | |
}; | |
// generateArrays(600, 36, 1, 99); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment