View Single Post
Old 01-23-2008, 06:38 PM   #5 (permalink)
RobertK
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
RobertK is on a distinguished road
Default

Sure.

What the script does, is it checks if a cookie named "arva" is set. If it is your first visit/guess with a new browser session (IE, the browser was closed before running the script) then it knows the cookie isn't there, and it sets "arva" to be a random number. It then pulls from the cookie the random number for the script's use.

The other one, your original one, always sets "arva" to be a random value. This value is never saved anywhere in your script. Thus, if you run it again you have a different number--in fact, your last answer could have been right this time.

That is the basic explanation of the two executions.
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote