https://www.jianshu.com/p/762bf1c490a5
public void Shuffle<T>(List<T> items)
{
//随机交换
int currentIndex;
T tempValue;
for (int i = items.Count - 1; i >= 0; i--)
{
currentIndex = rng.Range(i+1);
tempValue = items[currentIndex];
items[currentIndex] = items[i];
items[i] = tempValue;
}
}
网友评论