#include <iostream>

#include <random>
#include <cmath>

int custom_random_number(int min_excluded, int max_excluded)
{
    static std::random_device rd;
    static std::mt19937 gen(rd());
 
    // values near the mean are the most likely
    // standard deviation affects the dispersion of generated values from the mean
    double mean = (max_excluded - min_excluded) / 2.0;
    double variance = 100 * std::abs(max_excluded - min_excluded); // correlates to how "wide" you want the distribution to be
    std::normal_distribution<> d(mean, variance);
    int r;
    do {
        r = std::round(d(gen));
    } while ( r >= min_excluded && r <= max_excluded );
    return r;
}

#include <map>

#include <iomanip>

int main()
{
    int r = custom_random_number(0, 10);
    std::cout << r << "\n" << std::endl;
    
    std::map<int, int> hist;
    for(int n = 0; n < 10000; n++) {
        ++hist[custom_random_number(0, 10)];
    }
    for(auto p : hist) {
        std::cout << std::fixed << std::setprecision(1) << std::setw(2)
                  << p.first << ' ' << std::string(p.second, '*') << '\n';
    }
}
