Considering only the time returned by console.time()
and the bias as how many times the most common result was returned more than the least common result. Memory usage wasn't considered.
Took 1261ms to finish. It's biased: the most common result, "21345", showed 67 times more than least common result, "45321".
Took 846ms to finish. It's not biased: the most common result showed only 1.0667 times more than the least common result.
Took 1619ms to finish. It's not biased: the most common result showed only 1.0654 times more than the least common result.
Sort based shuffle seems intuitive, but as .sort
works comparing each array value each other it's slow and, because the comparison changes each time, it's biased. In the other hand the Fisher–Yates shuffle isn't biased and it's fast, but seems it's not too intuitive. The map sort based shuffle uses two maps and a sort, is slower and probably is the one which uses most memory, but isn't biased and it's simple to understand.