summaryrefslogtreecommitdiff
path: root/client/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/util.js')
-rw-r--r--client/util.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/client/util.js b/client/util.js
index 0fe17e9..6b1e274 100644
--- a/client/util.js
+++ b/client/util.js
@@ -6,5 +6,12 @@ const isDesktop = ! isMobile
document.body.classList.add(isDesktop ? 'desktop' : 'mobile')
-export default { isIphone, isIpad, isAndroid, isMobile, isDesktop }
+function randint(n){ return (Math.random()*n)|0 }
+function randrange(a,b){ return (Math.random()*(b-a)+a)|0 }
+function choice(a){ return a[randint(a.length)] }
+
+export {
+ isIphone, isIpad, isAndroid, isMobile, isDesktop,
+ randint, randrange, choice,
+}