Shuffle and Nobody Name Commands

This commit is contained in:
Daniel Odendahl Jr
2017-08-15 22:11:22 +00:00
parent 7cbdab46b1
commit d70e642760
4 changed files with 67 additions and 2 deletions
+10
View File
@@ -61,6 +61,16 @@ class Util {
static wait(time) {
return promisify(setTimeout)(time);
}
static shuffle(arr) {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
return arr;
}
}
module.exports = Util;