X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=utils%2Falea.js;h=d892824f14246a45508a55b573658955a1b77427;hb=c4d2eb5bdf1b23d8c4a9d09322f84a9e0da9d60c;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;