中间带两位随机数的混合时间的加密串函数
private static int RollDiceFunc(int sendnumber)
{
byte[] randnumbers = new byte[1];
RNGCryptoServiceProvider Gen = new RNGCryptoServiceProvider();
Gen.GetBytes(randnumbers);
int rand = Convert.ToInt32(randnumbers[0]);
return (rand % sendnumber)+1;
}
private string addFrontZero(string str, int len)
{
while (str.Length < len)
{
str = "0" + str;
}
return str;
}
调用:
_payNO = addFrontZero(CustomerId.ToString(), 7) + "9" + DateTime.Now.ToString("yyMMddHHmmss");