Thank you for the correction!
So, if the program picks 5 numbers one after another,
x1=..
x2=..
and so on, with the corrected expression and srand() present after
the variable declarations, those 5 numbers will not be following any
kind of a pattern?
Thank you very much!
I know, i know, "search" is supposed to be used... hehe, i'm sorry about that.
Very comprehensible explanation in that post. For now i'll just keep on using
real-world plastic little balls for any "bingo" games :-)
There is nothing wrong with using rand() for bingo.
Just seed rand() with a different value each time you run your program. To do that, call srand( time( 0 ) ) at the beginning of your program exactly once. As long as the clock on your PC keeps ticking you'll get different numbers each time your program runs.
Remember to seed rand () with srand() just once (and only once, not more), but you can seed it with a non static value like the clock of the system (srand(time(NULL))), the only problem with this is that the seed for this method changes every second, and if you run various instructions for retrieving random numbers under the same second, the random number will be the same (you'll have to wait for the clock to change to a new second to obtain a new random number, and you don't want to wait seconds), so, other alternatives are:
1.- seed with "ftime()" (Included in "sys/timeb.h") for milliseconds: