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();
}
转载于:https://www.cnblogs.com/94cool/archive/2011/06/13/2079366.html