projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes, improvements
[vchess.git]
/
client
/
src
/
utils
/
alea.js
diff --git
a/client/src/utils/alea.js
b/client/src/utils/alea.js
index
337b25f
..
0456393
100644
(file)
--- a/
client/src/utils/alea.js
+++ b/
client/src/utils/alea.js
@@
-5,7
+5,7
@@
export function getRandString()
.toUpperCase();
}
.toUpperCase();
}
-export function rand
om
(min, max)
+export function rand
Int
(min, max)
{
if (!max)
{
{
if (!max)
{
@@
-22,7
+22,7
@@
export function sample (arr, n)
let cpArr = arr.map(e => e);
for (let index = 0; index < n; index++)
{
let cpArr = arr.map(e => e);
for (let index = 0; index < n; index++)
{
- const rand =
getRandInt(index, n
);
+ const rand =
randInt(index, arr.length
);
const temp = cpArr[index];
cpArr[index] = cpArr[rand];
cpArr[rand] = temp;
const temp = cpArr[index];
cpArr[index] = cpArr[rand];
cpArr[rand] = temp;