Call srand once in a program, before the loop.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
I have tried that but it does not work. it produces same pattern of numbers.
Using the same seed will produce the same pattern. Oftensrand(time(NULL)); is used, but read the link prog-bman posted.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314