BlueGit

timfa frameworkv3

add array.random

timfa Tim Falken · pushed by timfa

Authored 2019-02-14 · 7 years ago

Hash
1a960e0ef5956aec0878909b6ac8fd149d5a0305
Parent
9b22d4f7
1 file changed +5 −0
framework/extentions.js +5 −0
@@ -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)
26Math.clamp = function(number, min, max)
26Math.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
31Array.prototype.random = function ()
32{
33 return this[Math.floor((Math.random()*this.length))];
29}
34}