Fisher-Yates shuffle algorithm in javascript, modern and inside-out versions
Unless you modify the inside out code to scale by (index+1)

       randomIndex = rand()*(index+1)|0;


You will not be covering all the possibilities.
For index == 0, you always generate 0 -- this is correct, but only by accident.

For index == 1, you also always generate 0 -- instead of a 50/50 split between 0 and 1

The second card in the deck misses its ONLY chance to get to be card[1].

The same problem continues for each card from then on, without the +1, randomIndex &lt; index  when you want randomIndex &lt;= index.

The problem may be even clearer for the last card placed in the deck. For a 52 card deck, index == 51, so randomIndex can be at most 50. So any prior card has a possibility of ending up at card[51], but not the last card. It can get no closer than card[50].

It should be reassuring that this change makes the math for the initial shuffle look more like that of the re-shuffle.