diff options
Diffstat (limited to 'js/util.js')
| -rw-r--r-- | js/util.js | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -47,6 +47,7 @@ function rand(n){ return (Math.random()*n) } function randint(n){ return rand(n)|0 } function randrange(a,b){ return a + rand(b-a) } function randsign(){ return random() >= 0.5 ? -1 : 1 } +function randnullsign(){ var r = random(); return r < 0.333 ? -1 : r < 0.666 ? 0 : 1 } function xrandom(exp){ return Math.pow(Math.random(), exp) } function xrand(exp,n){ return (xrandom(exp)*n) } |
