Hi
I wrote a funct my_random(limit) that 'should' return a pseudor-random value between 0 and limit-1, then I have a small prog like:
Code:
main_prog.c
..............
int random_value;
.............
srand(time(NULL)); //
random_value= my_random(limit); // here I call my funct
....
where my_random looks like
Code:
int my_random(int val){
int rand_choice=0;
rand_choice=rand()%(val);
printf("%d\n",rand_choice);
return rand_choice;
}
the problem in that i get always the same value. I'm reading some tutorials and I know that is important to choice the right place where put the srand(seed).
But I belived that outside the function should be enough, otherwise where should be the right position?
Thanks
D