Menu

#3 Die is a singleton but uses non-member global state

open
nobody
None
5
2004-05-18
2004-05-18
Chad Austin
No

This could be a thread safety issue. I'd recommend
making Die a normal class and encapsulate the global
state for the mersenne twister into members. Then we
could instantiate multiple dice for each thread.
However, maybe it's name should become something else,
like MTRand...

Discussion


Log in to post a comment.

MongoDB Logo MongoDB