diff options
| author | Jules Laplace <jules@okfoc.us> | 2013-08-02 17:21:32 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2013-08-02 17:21:32 -0400 |
| commit | 0003c072cb83f48386c5e264d86b0aa3a9eaa20d (patch) | |
| tree | bd9a40fd1c387cc054b03ec1376927e7027d330f /js/util.js | |
| parent | d4d9fc9513925397d71b4ac1ed3426fd6e7dc0e7 (diff) | |
app
Diffstat (limited to 'js/util.js')
| -rw-r--r-- | js/util.js | 5 |
1 files changed, 5 insertions, 0 deletions
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)]; } |
