This is a little snippet of code I wrote. Out of 1000 random integers I need to choose 50. This is what I wrote but it falls short. Any help?
Code:#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int x, y, ia[50];
for(x=0; x<50; x++) {
srand(time(NULL));
y=rand()%1000+1;
ia[x]=y;
printf("%d ", ia[x]);
}
return 0;
}