C language counts the number of occurrences of random numbers between 10 and 20?

  c++, question
#include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
 #define N 10
 
 int a[N];
 
 void gen_random(int min, int max)
 {
 int i;
 for (i = 0;   i < N;  ++i) {
 a[i] = rand() % min + (max - min + 1);
 }
 }
 
 int main(void)
 {
 int m, n, histogram[10] = {0};
 
 srand(time(NULL));
 gen_random(10, 20);
 
 for (m = 0;   m < N;  ++ m) {
 ++ histogram[a[m]];
 }
 
 for (n = 0;   n < N;  ++ n){
 printf("No.%d random number %d appears %d times\n", n, a[n], histogram[a[n]]);
 }
 
 return 0;
 }

The code generates a random integer between 10 and 20 and counts the number of occurrences of each number. However, there are negative numbers and abnormal statistical results. May I ask where is the problem with the code?
Error:

No.1 random number 17 appears 2 times
 No.2 random number 18 appears -68681239 times
 No.3 random number 14 appears -529580218 times
 No.4 random number 11 appears 2 times
 No.5 random number 20 appears 1 times
 No.6 random number 11 appears 2 times
 No.7 random number 16 appears 1 times
 No.8 random number 15 appears 32556 times
 No.9 random number 19 appears 32765 times
 Segmentation fault

OS: LinuxMint 17 rosa 64bit
GCC: 4.8.4

Curious, you use onehistogram[10]Array, why access is11-20The subscript of.