wp: text justification wip

This commit is contained in:
minjaesong
2021-06-19 15:48:59 +09:00
parent 8292c3c0b0
commit f87c63f02e
4 changed files with 173 additions and 16 deletions

View File

@@ -334,6 +334,25 @@ Array.prototype.tail = function() {
Array.prototype.init = function() {
return this.slice(0, this.length - 1)
}
Array.prototype.shuffle = function() {
let counter = this.length;
// While there are elements in the array
while (counter > 0) {
// Pick a random index
let index = Math.floor(Math.random() * counter);
// Decrease counter by 1
counter--;
// And swap the last element with it
let temp = this[counter];
this[counter] = this[index];
this[index] = temp;
}
return this;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// NOTE TO PROGRAMMERS: this JS_INIT script does not, and must not be invoked with strict mode //