c++ - Should I use std::default_random_engine or should I use std::mt19937? -
when want generate random numbers using std::random, engine should prefer? std::default_random_engine or std::mt19937? differences?
for lightweight randomnes (e.g. games), consider default_random_engine. if code depends heavily on quality of randomness (e.g. simulation software), shouldn't use it, gives minimalistic garantees:
it library implemention's selection of generator provides @ least acceptable engine behavior relatively casual, inexpert, and/or lightweight use.
the mt19937 32 bits mersene twister (or 64 bit counterpart mt19937_64) on other side well known algorithm passes statistical randomness tests. it's ideal scientific applications.
however, shall consider neither of them, if randomn numbers meant security (e.g. cryptographic) purpose.
Comments
Post a Comment