I'm testing the fisher yates shuffle on this online editor
this is the output.. as you can see the array is shuffled correctly..
however in RMMV..
this is the output.. i dont know what is wrong
JavaScript:
var t0 = [0,0,0,0,0,0,0,0,0,0,0,0,0];
var t1 = [1,1,1,1,1,1,1,1,1,1,1,1,1];
var t2 = [2,2,2,2,2,2,2,2,2,2,2,2,2];
var t3 = [3,3,3,3,3,3,3,3,3,3,3,3,3];
var t4 = t0.concat(t1,t2,t3);
console.log(t4);
var pp = t4; // array cards
for (var i = pp.length - 1; i > 0; i--) {
const swapIndex = Math.floor(Math.random() * (i + 1))
const currentCard = pp[i]
const cardToSwap = pp[swapIndex]
pp[i] = cardToSwap
pp[swapIndex] = currentCard
}
console.log(pp);
console.log(pp[0]);console.log(pp[4]);console.log(pp[8]);console.log(pp[12]);
this is the output.. as you can see the array is shuffled correctly..
however in RMMV..
this is the output.. i dont know what is wrong