RANDOM FUNCTION

i am making a railway ticket reservation program.i am using a random function to generate a ticket number randomly..all i want to know is will this function repeat the numbers when i run the program again...i dont want this thing to happen...and what can i do so that it generates only 6 digit number???
all i want to know is will this function repeat the numbers when i run the program again...i dont want this thing to happen...

It will. Use this: http://www.cplusplus.com/reference/clibrary/cstdlib/srand/

and what can i do so that it generates only 6 digit number???

The modulo operator is % in C++. However, note that you might need to combine the results of several rand() calls depending on how large RAND_MAX is.
so how can i stop it to repeat numbers?
When you call srand, use a different seed value.
Reading the links people post might actually help, despite how unbelievable it might sound.
Topic archived. No new replies allowed.