When I use this code, it works fine:
<% Function RandomNumber(in tHighestNumber)
Randomize
RandomNumber = Int(Rnd * intHighestNumbe r) + 1
End Function
SEEDNMBR=(Rando mNumber(16))
Response.Write SEEDNMBR %>
However, with the code below I get this error code:Microsoft VBScript compilation error '800a03ea'
Syntax error
/seed_modify_bat ch.asp, line 20
Function RandomNumber(in tHighestNumber)
^
This is the code that results in the above error:
<% for i=1 to 16
Function RandomNumber(in tHighestNumber)
Randomize
RandomNumber = Int(Rnd * intHighestNumbe r) + 1
End Function
SEEDNMBR=(Rando mNumber(16))
Response.Write SEEDNMBR
next
%>
FYI, I am using the function to generate 16 random integers from 1 to 16 so I can "seed" a golf bracket in a blind draw, or random fashion. Also, if I enclose the code in <script type="text/vbscript"> the function does not work even if the first example above. I am running this code on an active server page. I never need to use the script tags on any pages that I have on my website.
Thanks for help. Dave
<% Function RandomNumber(in tHighestNumber)
Randomize
RandomNumber = Int(Rnd * intHighestNumbe r) + 1
End Function
SEEDNMBR=(Rando mNumber(16))
Response.Write SEEDNMBR %>
However, with the code below I get this error code:Microsoft VBScript compilation error '800a03ea'
Syntax error
/seed_modify_bat ch.asp, line 20
Function RandomNumber(in tHighestNumber)
^
This is the code that results in the above error:
<% for i=1 to 16
Function RandomNumber(in tHighestNumber)
Randomize
RandomNumber = Int(Rnd * intHighestNumbe r) + 1
End Function
SEEDNMBR=(Rando mNumber(16))
Response.Write SEEDNMBR
next
%>
FYI, I am using the function to generate 16 random integers from 1 to 16 so I can "seed" a golf bracket in a blind draw, or random fashion. Also, if I enclose the code in <script type="text/vbscript"> the function does not work even if the first example above. I am running this code on an active server page. I never need to use the script tags on any pages that I have on my website.
Thanks for help. Dave
Comment