Tried to make a guessing game, what do u think?
View Single Post
01-23-2008, 06:38 PM
Join Date: Jan 2008
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
View Public Profile
Send a private message to RobertK
Find More Posts by RobertK