//将从0到n*n - 1放到一个n*n数组中
public static void TestArray(int dimension, System.Text.StringBuilder sb)
{
sb.Append(Environment.NewLine);
IList<int> results = new List<int>();
int totalCount = dimension * dimension;
int curIndex = 0;
byte[] guidByte = Guid.NewGuid().ToByteArray();
int seed = Environment.TickCount ^ guidByte[0];
Random randObj = new Random(seed);
for (int i = 0; i < totalCount; i++)
{
curIndex = randObj.Next(i + 1);
results.Insert(curIndex, i);
}
for (int i = 0; i < totalCount; i++)
{
if ((i % dimension) == 0)
{
sb.Append(Environment.NewLine);
}
sb.AppendFormat("{0}", results[i].ToString().PadRight(10, ' '));
}
}