Fix (a lot but maybe not all of) Chakart
[xogo.git] / utils / alea.js
index aa3aa57..751d347 100644 (file)
@@ -34,7 +34,8 @@ export const Random = {
       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) {