go语言实现Fisher–Yates shuffle 算法 运行效果示例 说明 下面是用 Go 语言实现的 Fisher–Yates shuffle 算法的完整源码,包括注释,演示了如何对一个整型切片进行原地随机洗牌。 package main import ( "fmt" "math/rand" "time" ) // FisherYatesShuffle 对切片 nums 进行原地洗牌 func FisherYatesShuffle(nums []int) { rand.