projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Untested draft refactor both/moves/attack for pieces specs
[xogo.git]
/
utils
/
alea.js
diff --git
a/utils/alea.js
b/utils/alea.js
index
aa3aa57
..
077970d
100644
(file)
--- a/
utils/alea.js
+++ b/
utils/alea.js
@@
-22,7
+22,7
@@
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;
},
@@
-34,7
+34,8
@@
export const Random = {
const rand = Random.randInt(index, arr.length);
[ cpArr[index], cpArr[rand] ] = [ cpArr[rand], cpArr[index] ];
}
const rand = Random.randInt(index, arr.length);
[ cpArr[index], cpArr[rand] ] = [ cpArr[rand], cpArr[index] ];
}
- return cpArr.slice(0, n);
+ const res = cpArr.slice(0, n);
+ return (n >= 2 ? res : res[0]);
},
shuffle: function(arr) {
},
shuffle: function(arr) {