vendredi 3 décembre 2021

more diversity in randomizing numbers?

i am making a horse racing game. Every 500ms i display the race lanes and add a random position between 1-4 to every horse, but it seems like almost everytime 5 wins, its like a 70%.

The same on another game named roullete, the average number that gets picked is 11.

I am using Mersenne Twister generator and this is the method i am using:

int random(int a, int b)  {
    static std::random_device rd;
    static std::mt19937 generator(rd());
    std::uniform_real_distribution<> distribution( a, b );
    return distribution(generator);
}

any tips on making the numbers even more random?




Aucun commentaire:

Enregistrer un commentaire