random value problem
random value problem
- Subject: random value problem
- From: Mike Brinkman <email@hidden>
- Date: Thu, 18 Apr 2002 16:09:05 -0400
Inspired by Aaron Hillegass's book, I decided to write my own lottery
program. I've got it set up so that a person enters six numbers, presses the
"Play!" button (or presses the return/enter key), and the program reads in
the person's numbers, generates random numbers, sorts both lists of numbers,
compares the two, and then decides if the person won any money. Everything
seems to work pretty well, but I've still got to do error checking code and
add some more memory management.
The one problem I'm experiencing though is that if I hit the return key
quickly, the program doesn't generate new random numbers. If I wait half a
second between hitting the key, new numbers get generated. I know that it
isn't creating new numbers, because I've got a counter that counts how many
times somebody has played.
I call srandom(time(NULL)) at the top of my method that receives the
button/enter key action. Anybody have any ideas?
Thanks!
Mike Brinkman
Rookie Cocoa Programmer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.