I have a C code file (call \"test.c\" and output is \"test.out\") like below and just a simple output of random number:
int main()
{
rand() will produce the same sequence of numbers for the same seed (the one you set with srand()).
It's very likely that your loop runs too fast and all your runs end up using the same seed (i.e. time(NULL) returns same value). Hence, you see the same output.
You can drand48() instead for producing uniformly distributed numbers. Or if you simply want to test rand(), you can just add a delay between your iterations.