Skip to content

Instantly share code, notes, and snippets.

@biac
Created June 11, 2012 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biac/2909297 to your computer and use it in GitHub Desktop.
Save biac/2909297 to your computer and use it in GitHub Desktop.
Kujian - 参加者.cs (Create 時に並びをランダムにする)
public static IList<参加者> Create()
{
// …前略
}).ToList();
int count = list.Count;
var rnd = new Random();
for (int i = 0; i < count; i++)
{
int src = rnd.Next(0, count);
int dest = (src + rnd.Next(1, count)) % count;
var tmp = list[dest];
list[dest] = list[src];
list[src] = tmp;
}
return list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment