[thelist] Random Numbers in ASP
Anthony Baratta
Anthony at Baratta.com
Thu Jul 25 18:47:00 CDT 2002
At 02:16 PM 7/25/2002, Ken Kogler wrote:
>I want to write a function that takes a number as a parameter, and returns a
>random number between 1 and whatever number it was given.
''''''''''''''''''''''''''''''''''''''''''''''''''
'' GetRandomNmbr Function
'' Required Info Passed to Function:
'' varMaxNumber
''''''''''''''''''''''''''''''''''''''''''''''''''
Function GetRandomNmbr(varMaxNumber)
if isNumeric(varMaxNumber) then
nSeed = Right(Abs(DateDiff("s",Now,#1/1/1998#)),4)
Randomize nSeed
nRandom = Int((CInt(varMaxNumber) * Rnd) + 1)
else
nRandom = 0
end if
GetRandomNmbr = nRandom
End function
--
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list