Should I use std::default_random_engine or should I use std::mt19937?

后端 未结 3 2051
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-01 13:47

when I want to generate random numbers using std::random, which engine should I prefer? the std::default_random_engine or the std::mt19937? what ar

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 13:58

    They address different needs. The first is an implementation-defined alias for a certain generator whilst the latter specifically uses the Mersenne-Twister algorithm with a 32 bit seed.

    If you don't have particular requirements, std::default_random_engine should be ok.

提交回复
热议问题