Fix range utils, move array chunk util to shared

This commit is contained in:
Vortrex
2021-12-03 10:24:01 -06:00
parent 271e512d46
commit 832545e9c9
2 changed files with 17 additions and 41 deletions

View File

@@ -850,4 +850,14 @@ function getRandom(min, max) {
return Math.floor(Math.random() * (toInteger(max) - toInteger(min) + 1)) + toInteger(min)
}
// ===========================================================================
function splitArrayIntoChunks(originalArray, perChunk) {
let tempArray = [];
for (let i = 0; i < originalArray.length; i += perChunk) {
tempArray.push(originalArray.slice(i, i + perChunk));
}
return tempArray;
}
// ===========================================================================