mercredi 28 juillet 2021

Best way to set up RNG for use in class? (C++)

I'm writing a class that contains an unordered_map dispatch holding anonymous functions. The class is declared in a header file and defined in a separate .cpp file. I'm currently defining my map in the constructor's initializer list.

Chip8::Chip8()
    : dispatch
    {
        {0x00e0, [this]() { display.fill(0); }},
        ...

In one of these functions, I need to obtain a random number. I presume this is an issue understanding scope as I am unsure where to seed my RNG.




Aucun commentaire:

Enregistrer un commentaire