Doubts regarding random numbers generation

This is a discussion on Doubts regarding random numbers generation within the C Programming forums, part of the General Programming Boards category; At first my new year wishes to all members. 
My doubts are
1.  How can i generate 10 random numbers ...

Doubts regarding random numbers generation

1.  How can i generate 10 random numbers from 1 to 10, But here the condition is the generated random numbers should be odds only and not evens or vice versa. 

2.  The srand() function uses a different seed value on every run, causing a different set of random values every run.  According to this, the srand() function gets one different vlaue for each run.  Can we can't get more than one values for srand() function for each run of program. 

1.  use rand() % 10 + 1 if it's even (result % 2 == 0) then add 1 to make it odd be careful with 10 though -- 10 is even so you can ignore that anyway and generate from 1 to 9. 
2.  What?!?  You seed the random number generator with srand()

im confused by your use of "doubts".  do you mean something like "constraint" or "restriction"/"requirement"? 

1.  How can i generate 10 random numbers from 1 to 10, But here the condition is the generated random numbers should be odds only and not evens or vice versa. 

so you want even numbers from 1-10?  simply generate numbers from 1-5 and multiply each by 2 (resulting in 2,4,6,8,10). 

2.  The srand() function uses a different seed value on every run, causing a different set of random values every run. 

otherwise it wouldnt be very random would it?! 

According to this, the srand() function gets one different vlaue for each run.  Can we can't get more than one values for srand() function for each run of program. 

your wording is confusing.  what exactly are you asking?  if you dont provide a seed, you should get the same sequence if thats what your looking for.  if your wanting to provide two seeds there isnt really a point, the first one should make it random enough.  most often people will use the current time as the seed. 

Just so you know, you've been taught wrong.  The word you should have used is "question", not "doubt", and a question must end in a question mark (a "?"). 
You can be pretty sure that the word "doubt" is basically never the right word to use if English is your second language. 

You can be pretty sure that the word "doubt" is basically never the right word to use if English is your second language. 

I sort of doubt that

Just to clarify for girish1026, however, the word "doubt" is a verb for "being uncertain", but it is always used in contexts where there is some level of distrust.  The word "question" is used to raise a concern for discussion, when seeking a reply or explanation, in a more neutral manner. 

hmm i dont know if you are serious or not!  but if he/she was asking for even random numbers from 1-10, using random numbers from 1-5 and multiplying will give range of 2,4,6,8,10.  im not sure what you mean by subtract 1 for the odds?  unless of course I am misunderstanding the question!  oh well

hmm i dont know if you are serious or not!  but if he/she was asking for even random numbers from 1-10, using random numbers from 1-5 and multiplying will give range of 2,4,6,8,10.  im not sure what you mean by subtract 1 for the odds?  unless of course I am misunderstanding the question!  oh well

Grumpy's a seriously smart guy, and he's not joking. ( Note the forum name he uses)

You have even numbers when you multiply 1-5 by 2, in the range 1 through 10. 

If you wanted odd numbers, instead of evens, you could do the same multiplication, and then subtract 1, to get the odd numbers, in the range of 1 through 10.