#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int r, a = 10, b = 20;
srand((unsigned)time(NULL));
for(int i = 0; i < 100; i++)
{
// rand() % (21) = between 0 - 20 + 10 = between 10 - 20
r = rand() % (b - a + 1) + a; // between 10 - 20
printf("%d\t", r);
}
return 0;
}
/*
run:
16 17 14 16 15 12 19 14 13 10
19 13 17 15 12 16 15 12 17 20
16 16 13 20 12 11 12 15 10 13
13 12 15 10 14 16 13 11 17 17
14 20 19 18 13 12 17 17 16 11
11 12 11 17 20 17 11 13 17 18
17 12 18 13 17 20 20 15 11 13
11 18 17 10 13 16 18 16 13 16
15 14 14 12 17 20 13 12 20 19
13 12 19 12 10 14 19 18 13 17
*/