BlueGit

timfa frameworkv3

randomRange

timfa Tim · pushed by timfa

Authored 2022-10-19 · 4 years ago

Hash
9dfbf17515912b85584dfaa466d7d7204c7757c6
Parent
2c04881f
1 file changed +5 −0
framework/extensions/extentions.js +5 −0
@@ -36,6 +36,11 @@ Math.clamp = function(number, min, max)
36 36 return Math.min(max, Math.max(min, number));
37 37 }
38 38
39 Math.randomRange = function(min, max)
40 {
41 return min + (Math.random() * (max - min));
42 }
43
39 44 Array.prototype.random = function ()
40 45 {
41 46 return this[Math.floor((Math.random()*this.length))];
@@ -36,6 +36,11 @@ Math.clamp = function(number, min, max)
36 return Math.min(max, Math.max(min, number));
36 return Math.min(max, Math.max(min, number));
37}
37}
38
38
39Math.randomRange = function(min, max)
40{
41 return min + (Math.random() * (max - min));
42}
43
39Array.prototype.random = function ()
44Array.prototype.random = function ()
40{
45{
41 return this[Math.floor((Math.random()*this.length))];
46 return this[Math.floor((Math.random()*this.length))];