思路:利用double的随机数,来确定Long的随机数。
public static long NextLong(long A,long B)
{
long myResult = A;
//-----
long Max=B , Min=A;
if (A > B)
{
Max = A;
Min = B;
}
Random R = new Random();
double Key = R.NextDouble();
myResult = Min + (long)((Max - Min) * Key);
//-----
return myResult;
}