Fisher-Yates 洗牌算法(原地洗牌) Fisher-Yates shuffle algorithm (in-place)
需要洗牌的数组 / Array to shuffle
洗牌后的数组(原地修改) / Shuffled array (modified in-place)
// 原地洗牌const arr = [1, 2, 3, 4, 5]shuffle(arr) // arr 已被洗牌 Copy
// 原地洗牌const arr = [1, 2, 3, 4, 5]shuffle(arr) // arr 已被洗牌
Fisher-Yates 洗牌算法(原地洗牌) Fisher-Yates shuffle algorithm (in-place)