日期:2014-05-17 浏览次数:20886 次
/// <summary>
/// 根据获取抽到的奖品
/// </summary>
/// <param name="lotteryRules"></param>
/// <returns></returns>
public int GetLotteryPoints(int oldPoints)
{
Random random = new Random(GetRandomSeed());
int m = random.Next(2);
if (m == 1)
{
return this.MinAward;
}
else
{
return this.MaxAward;
}
}
/// <summary>
/// 获取随机种子值,防止连续快速取随机数重复问题
/// </summary>
/// <returns></returns>
public static int GetRandomSeed()
{
byte[] bytes = new byte[4];
System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
rng.GetBytes(bytes);
return BitConverter.ToInt32(bytes, 0);
}