std::random_device provides significantly more entropy than std::time(0)


👍 g++ -std=c++11 randoms_seeded.cpp
👍 ./a.out
1486343927 2026537594 821111830 
👍 ./a.out
1520403021 1120590466 1204283650 
👍 cat randoms_seeded.cpp 
#include <iostream>
#include <random>
using namespace std;

int main() {
  default_random_engine
    e(random_device{}());
  for (size_t i = 0; i < 3; ++i)
    cout << e() << ' ';
  cout << endl;
}

    

17.4.1 Random-Number Engines and Distribution p877 of