mardi 13 octobre 2020

proper implementation of binomial distribution?

I'm trying to get binomial distribution to return a value within a range with a higher probability of being in the lower spectrum, and all I can get it to return is 37. Here's my implementation:

int32_t binomial_random(int32_t minNumber, int32_t maxNumber, float modifier) {
    std::default_random_engine generator;
    static std::binomial_distribution<int> binomialRand(maxNumber, modifier);
    return minNumber + binomialRand(generator);
}

and when i call it:

level = binomial_random(minLevel, maxLevel-minLevel, 0.3f);

it appears to be returning 37 regardless of minLevel and maxLevel




Aucun commentaire:

Enregistrer un commentaire