public string GetRan(int NumSides)
{
byte[] randomNumber = new byte[NumSides];
Gen.GetBytes(randomNumber);
int rand = Convert.ToInt32(randomNumber[0]);
StringBuilder sb = new StringBuilder();
foreach (byte by in randomNumber)
{
sb.Append(Convert.ToInt32(by) % NumSides + 1);
}
return sb.ToString();
}
{
byte[] randomNumber = new byte[NumSides];
Gen.GetBytes(randomNumber);
int rand = Convert.ToInt32(randomNumber[0]);
StringBuilder sb = new StringBuilder();
foreach (byte by in randomNumber)
{
sb.Append(Convert.ToInt32(by) % NumSides + 1);
}
return sb.ToString();
}
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/archive/2011/06/13/2079366.html,如需转载请自行联系原作者