summaryrefslogtreecommitdiff
path: root/js/vendor/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/util.js')
-rw-r--r--js/vendor/util.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/js/vendor/util.js b/js/vendor/util.js
index 0aabd29..b5ee7c7 100644
--- a/js/vendor/util.js
+++ b/js/vendor/util.js
@@ -13,6 +13,7 @@ function randint(n){ return rand(n)|0 }
function randrange(a,b){ return a + rand(b-a) }
function choice(a){ return a[randint(a.length)] }
function clamp(n,a,b){ return n<a?a:n<b?n:b }
+function norm(n,a,b){ return (n-a) / (b-a) }
function lerp(n,a,b){ return (b-a)*n+a }
function avg(m,n,a){ return (m*(a-1)+n)/a }
function mod(n,m){ return n-(m * Math.floor(n/m)) }