Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 2
    Of note, there is a 64 bit version of std::mt19937: std::mt19937_64 that returns 64 bits of randomness per call. auto rnd5 = std::mt19937_64(std::random_device{}()); // min: 4879020137534 mean: 1655417118684 max: 18446741225191893648 Commented Apr 6, 2013 at 8:17
  • By the way, is it safe to re-use the same random number engine with many distributions and std::bind() or is it better to bind each distribution to a new engine instance? How's this: std::mt19937_64 random = std::mt19937_64(std::random_device{}()); auto randomCardinality = std::bind(std::uniform_int_distribution<int>(1, 4), random); auto randomValue = std::bind(std::uniform_real_distribution<double>(-1.0, 1.0), random); Commented Sep 15, 2015 at 10:27