Hi all,
I'm using the rand function.. I used it correctly but I can't understand why it returns sometimes the same values of a previous computation.
I use to write:
When I use this code in a call to function like this:
The values returned for the lists are everytime the same... why??Code:buildListsOfRandom(){ for (i=1 TO K){ createRandomList() } } createRandomList(){ srand ( time(NULL) ); randNum= rand() % 100; }
Maybe I have to use the srand function in some other place?