(Classic ASP) Generating Random Integer in Range
Demonstrates how to generate random integers in a specified range.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' All Chilkat classes can be unlocked at once at the beginning of a program
' by calling UnlockBundle. It requires a Bundle unlock code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Global")
set chilkatGlob = Server.CreateObject("Chilkat.Global")
success = chilkatGlob.UnlockBundle("Anything for 30-day trial.")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( chilkatGlob.LastErrorText) & "</pre>"
Response.End
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Prng")
set fortuna = Server.CreateObject("Chilkat.Prng")
' Generate random integers between 12 and 24 inclusive
For i = 0 To 100
Response.Write "<pre>" & Server.HTMLEncode( fortuna.RandomInt(12,24)) & "</pre>"
Next
%>
</body>
</html>
|