I want to get ten(10) different random integers with rand(3) but almost all the time fail to get ten different numbers. My code is as follows:

Code:

```
int left[9]={0,0,0,0,0,0,0,0,0}, k;
for (k=0;k<9;k++)
left[k]=rand() % 10;
for (k=0;k<9;k++)
printf("integer[%d] is %d\n",k,left[k]);
```

With best regards,

MNIHKLOM