"use strict";

/**
 * Removes deleteValue wherever it appears in array
 */

Object.defineProperty(Array.prototype, 'clean', {
	enumerable: false,
	value: function (deleteValue) {
		for (var i = 0; i < this.length; i++) {
			if (this[i] === deleteValue) {
				this.splice(i, 1);
				i--;
			}
		}
		return this;
	}
});

/**
 * Shuffles an array internally
 */
Object.defineProperty(Array.prototype, 'shuffle', {
	enumerable: false,
	value: function () {
		for (let i = this.length; i; i--) {
			let j = Math.floor(Math.random() * i);
			[this[i - 1], this[j]] = [this[j], this[i - 1]];
		}
	}
});

/**
 * Get a random item from the array
 */
Object.defineProperty(Array.prototype, 'getRandom', {
	enumerable: false,
	value: function () {
		return this[Math.floor(Math.random() * this.length)];
	}
});

/**
 * Get a average from the array (Array must be numeric values)
 */
Object.defineProperty(Array.prototype, 'getAverage', {
	enumerable: false,
	value: function () {
		let total = 0;
		for (var i = 0; i < this.length; i++) {
			total += this[i];
		}
		return total / this.length;
	}
});
//# sourceMappingURL=array.js.map