获得一个随机数
VB.NET
C#
省略
示例代码:
Response.Write(GetRandomNumber(1.6))
Public Function GetRandomNumber(Optional ByVal Low As Integer = 1, Optional ByVal High As Integer = 100) As Integer
Dim oRandom As System.Random
oRandom = New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))
Return oRandom.Next(Low, High + 1)
End Function
Dim oRandom As System.Random
oRandom = New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))
Return oRandom.Next(Low, High + 1)
End Function
省略
示例代码:
Response.Write(GetRandomNumber(1.6))