X-Git-Url: https://git.auder.net/assets/rpsls.css?a=blobdiff_plain;f=utils%2Falea.js;h=d892824f14246a45508a55b573658955a1b77427;hb=0adfbdb55452c79532875beb8eed61b1ed4c6cd2;hp=751d3474b42a5fd6bebaefddb0fbf49d8a719e98;hpb=3b641716d7e86d9f1b39d1e046ce197e6b5a8075;p=xogo.git diff --git a/utils/alea.js b/utils/alea.js index 751d347..d892824 100644 --- a/utils/alea.js +++ b/utils/alea.js @@ -22,10 +22,14 @@ export const Random = { min = 0; } if (!Random.rand) - Random.setSeed(Math.floor(Math.random() * 1984)); + Random.setSeed(Math.floor(Math.random() * 19840)); return Math.floor(Random.rand() * (max - min)) + min; }, + randBool: function() { + return Random.randInt(0, 2) == 0; + }, + // Inspired by https://github.com/jashkenas/underscore sample: function(arr, n) { n = n || 1;