你的位置:首页 > ASP.net教程

[ASP.net教程]获得四位的随机数


/// <summary>
/// 获得四位的随机数
/// </summary>
/// <returns></returns>
public string Randomnum()
{
Random ro = new Random();
int iResult;
int iUp = 999;
int iDown = 10;
iResult = ro.Next(iDown, iUp);
return iResult.ToString().Trim();
}