将代码过程中比较重要的一些代码备份一次,如下的代码内容是关于C#生成随机ArrayList的代码,应该能对小伙伴们也有好处。
public static void RandomizeArrayList(ArrayList arrayList, Random random) {
if(arrayList == null) { return; }
int count = arrayList.Count;
for(int i=0;i<count;i++) {
Object tmp = arrayList[i];
arrayList.RemoveAt(i);
arrayList.Insert(random.Next(count), tmp);
}
}