Search code examples
asp-classic

ASP - Randomize function returning same value for two different seeds


So I'm generating a random number using Rnd and Randomize to set a seed that looks like this:

Randomize lSeed
Response.Write Rnd

I'm noticing that it's returning the same result for two values in a row for lSeed (e.g. 123, 124) but then on say 125 it will return a new value but 126 will be the same as the on for 125. Why would this be?

Edit:

I have tried something like this

Randomize
Randomize lSeed
Response.write Rnd

And I get the same results I described above.


Solution

  • The issue was that the value for the seed was too large in the other environment (an incrementing database value). I ended up doing value Mod 100 to get something semi-random and that was going to be low to always work.