fork(1) download
  1. // linear_congruential_engine::operator()
  2. #include <iostream>
  3. #include <chrono>
  4. #include <random>
  5.  
  6. int main ()
  7. {
  8. // obtain a seed from the system clock:
  9. unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
  10.  
  11. std::minstd_rand0 generator (seed); // minstd_rand0 is a standard linear_congruential_engine
  12. std::cout << "Random value: " << generator() << std::endl;
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Random value: 1347734568