Creates a new shuffled array via the Durtenfeld shuffle algorithm.
https://en.wikipedia.org/wiki/Fisher–Yates_shuffle#The_modern_algorithm
the array to shuffle
a new shuffled array
Shuffle an array.
import { shuffle } from "@trashpanda001/helpers/array"shuffle([1, 2, 3, 4, 5])// [2, 4, 1, 5, 3] Copy
import { shuffle } from "@trashpanda001/helpers/array"shuffle([1, 2, 3, 4, 5])// [2, 4, 1, 5, 3]
Creates a new shuffled array via the Durtenfeld shuffle algorithm.
https://en.wikipedia.org/wiki/Fisher–Yates_shuffle#The_modern_algorithm