thanks for help, but, problem it is not in this fucntion, problem in my_rand() fucntion. i want always different number between 0 and 3. But if i will use your uppear examples, i always will have on running stage the same number.
also i was try to do loop with 10 cicles:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
main()
{
int a=0;
int count=0;
while(count <10)
{
a=1+(int)(3.0*rand()/(RAND_MAX+1.0));
printf("%d\n",a);
count++;
};
}
and was have this result:
1
1
1
1
1
3
1
3
3
1
looks like not so randomize (where is 2?
), and if i run programm agayn, result is always the same. So, i must add in my_rand() and srand() too ?
At this moment i just interesting in little code, which i can compile on sasc, and after running of this programm, i always will have different numbers (and pretty random numbers) between 0 and 3. it is possible ?