To shuffle an array in JavaScript, one way is to use the Fisher-Yates (aka Knuth) shuffle algorithm. Here's the code:
index.tsx186 chars8 lines
This function takes an array as an argument and shuffles it in place using the algorithm. The array is returned as the result so you can easily use it in your code.
gistlibby LogSnag