Array.prototype.equals = function (array, strict = true) {
    if (!array) {
        return false
    }
    if (this.length != array.length) {
        return false
    }

    for (var i = 0; i < this.length; i++) {
        if (strict && this[i] != array[i]) {
            return false
        }
        else if (!strict) {
            return this.sort().equals(array.sort(), true)
        }
    }
    return true
}


Array.prototype.remove = function (obj) {
    const index = this.indexOf(obj)
    if(index != -1) {
        this.splice(index, 1)
    } else {
        console.warn(`did not find ${obj} in array ${this}`)
    }
}

Array.prototype.random = function() {
    return this[Math.floor(Math.random() * this.length)]
}

Array.prototype.shuffle = function() {
    let j, swap
    for (let i = this.length - 1; i > 0; i--) {
        j = Math.floor(Math.random() * (i + 1))
        swap = this[i]
        this[i] = this[j]
        this[j] = swap
    }
    return this
}