cgsdev0 / rollycubes

online multiplayer dice game
https://rollycubes.com/
MIT License
19 stars 10 forks source link

Game::roll makes a new random device for every die rolled #30

Closed brimonk closed 1 year ago

brimonk commented 2 years ago

Currently, Game::roll makes a new std::random_device for every die that gets rolled.

https://github.com/cgsdev0/rollycubes/blob/main/src/Game.cpp#L324

While it's implementation dependent, it seems like at the least this should be promoted to one instance per Game. If you're really nuts, you could make it one instance per thread / process.