Quote Originally Posted by en061
Means i should call srand outside the for loop?
Before the loop, yes. One way is to call it as near as possible to the beginning of the global main function.

Quote Originally Posted by en061
How do i avoid having the zeros in the random number?? I just need the number among 1 to 5.
With the current method that you are using, you can add 1 to the result to shift the range from [0, 4] to [1, 5].