dimanche 26 février 2017

Random numbers mt19937 repeats same numbers

Hello I have a problem with mt19937_64. I keep getting repeats due to the seed not changing with every computational cycle. Help would be very much obliged.

int ploop;
unsigned seed;

while (true)
{
    for (int x = 0; x < 16000; ++x)
    {
        for (int y = 0; y < 16000; y++)
        {   




             seed = std::chrono::system_clock::now().time_since_epoch().count();

            std::mt19937 generator (seed); 



            std::mt19937 mt(seed);

            std::uniform_int_distribution<int> scolp(0, 3);

            ploop = scolp(mt);

            std::cout << scolp(mt) << " ";
            std::cout << ploop << " " << std::endl;

        }

    }




}




Aucun commentaire:

Enregistrer un commentaire