According to Cplusplus.com, rand() returns a pseudo-random integral number in the range 0 to RAND_MAX. This number is generated by an algorithm that returns a sequence of apparently non-related numbers each time it is called. This algorithm uses a seed to generate the series, which should be initialized to some distinctive value using srand.

And that's all you need to know about that.

Now for this:

urgent. as soon as possible.

If you hadn't waited for the last minute to start your homework, it wouldn't be urgent now would it?

hello. thanxs.
can u pls conform this equation : any no from 0 to 9 are used and after module and add 1 store in x. pls reply.

According to Cplusplus.com, rand() returns a pseudo-random integral number in the range 0 to RAND_MAX. This number is generated by an algorithm that returns a sequence of apparently non-related numbers each time it is called. This algorithm uses a seed to generate the series, which should be initialized to some distinctive value using srand.

And that's all you need to know about that.

Now for this:

If you hadn't waited for the last minute to start your homework, it wouldn't be urgent now would it?

sorry for the disturb you. but i m big problem.
i make a sudoku game and for that i use this conditon to generate a random no bet o to 9.
i want to conform it takes a value by following code. i m new in programming. and donot know how to do this game. and i have only 4 days to complete it..

Too vague.

What do you want? Do you want a random number between 0-9 or 1-10? How big is your x[] array? Where do you seed the random generator with srand()?

sorry for the disturb you. but i m big problem.
i make a sudoku game and for that i use this conditon to generate a random no bet o to 9.

All the sudoku's I've ever played had numbers from 1-9 and not 0-9, but whatever. Here's a small example that gives 1 random number in the range 1-9:

// Seed the generator. Do this ONLY ONCE
srand((unsigned)time(NULL));
cout << (rand() % 9) +1;

i m new in programming. and donot know how to do this game. and i have only 4 days to complete it..

If you're new in programming and this is your first assignment and you only got 4 days to finish it, you should complain to your teacher, not me.
But I guess that this isn't your first assignment right? And you probably got more then 4 days to finish it, true?
So, again: If you started earlier, you wouldn't have a problem now.

thank u niek for the help. i started this game 3 days ago, but to develop a logic my time is spent. i m not complain to u. and i m not a student i m a flash developer. i m new in development. this is my first task, and that's why i want to do my best to complete it. b'coz first impression is last imperssion.

All the sudoku's I've ever played had numbers from 1-9 and not 0-9, but whatever. Here's a small example that gives 1 random number in the range 1-9:

// Seed the generator. Do this ONLY ONCE
srand((unsigned)time(NULL));
cout << (rand() % 9) +1;

If you're new in programming and this is your first assignment and you only got 4 days to finish it, you should complain to your teacher, not me.
But I guess that this isn't your first assignment right? And you probably got more then 4 days to finish it, true?
So, again: If you started earlier, you wouldn't have a problem now.