So basically i wrote this function in C to generate 5 random numbers from 1 to 50:
#include <stdio.h>
#include <stdlib.h>
int main() {
int c, n;
printf("Five random numbers from 1 to 50 \n");
for (c = 1; c <= 5; c++) {
n = rand()%50 + 1;
printf("%d\n", n);
}
return 0;
}
and i'd like to know how can i be sure that the numbers generated by this code are all different from each other.
Any help ?