add array.random
@@ -26,4 +26,9 @@ Array.prototype.contains = function(element)
26
26
Math.clamp = function(number, min, max)
27
27
{
28
28
return Math.min(max, Math.max(min, number));
29
}
30
31
Array.prototype.random = function ()
32
{
33
return this[Math.floor((Math.random()*this.length))];
29
34
}
@@ -26,4 +26,9 @@ Array.prototype.contains = function(element)26
Math.clamp = function(number, min, max)26
Math.clamp = function(number, min, max)27
{27
{28
return Math.min(max, Math.max(min, number));28
return Math.min(max, Math.max(min, number));29
}30
31
Array.prototype.random = function () 32
{33
return this[Math.floor((Math.random()*this.length))];29
}34
}