Skip to content

Comment on C++ Seeding Surprises (2015)parent

Comments

Sadly, people that don't know better use std::mt19937 all the time :-(.

And the only reason is its cool name. Humans are weird

I used it because it was recommended by Stephan T. Lavavej, maintainer of Visual Studio's C++ Standard Library, in his "rand() Considered Harmful" talk, back when <random> was introduced. See 11m30s. https://youtu.be/LDPMpc-ENqY?t=10m50s

Well, it's in std. So there's an appeal to authority (the C++ language authors should be smart, right?) and convenience.

There are still others in <random>. Yet they always use the cool twister one with the funny numbers

There's std::linear_congruential_engine, but it doesn't provide you with any (good) default parameters; only the bad ones from historical rand() implementations (minstd_rand0 / minstd_rand).

What alternative within <random> would you recommend and why?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.