projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update
[xogo.git]
/
utils
/
alea.js
diff --git
a/utils/alea.js
b/utils/alea.js
index
751d347
..
d892824
100644
(file)
--- a/
utils/alea.js
+++ b/
utils/alea.js
@@
-22,10
+22,14
@@
export const Random = {
min = 0;
}
if (!Random.rand)
min = 0;
}
if (!Random.rand)
- Random.setSeed(Math.floor(Math.random() * 1984));
+ Random.setSeed(Math.floor(Math.random() * 1984
0
));
return Math.floor(Random.rand() * (max - min)) + min;
},
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;
// Inspired by https://github.com/jashkenas/underscore
sample: function(arr, n) {
n = n || 1;