#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
int num = 0;
int index;
int array[10] = {0};
while(num < 10){
index = arc4random_uniform(10);
if(array[index] == 0){
array[index] = num++;
}
}
for(int i = 0; i < 10; i++){
printf("%d\n",array[i]);
}
return 0;
}
|
|