From 0003c072cb83f48386c5e264d86b0aa3a9eaa20d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:21:32 -0400 Subject: app --- js/util.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 js/util.js (limited to 'js/util.js') diff --git a/js/util.js b/js/util.js new file mode 100644 index 0000000..5828a91 --- /dev/null +++ b/js/util.js @@ -0,0 +1,5 @@ + +function avg(a,b,n){ return (a*(n-1) + b)/n; } +function rand(n) { return ~~(Math.random()*n); } +function randrange(a,b){ return (b-a)+rand(a); } +function choice(a) { return a[rand(a.length)]; } -- cgit v1.2.3-70-g09d2