fork download
  1. #include <time.h>
  2.  
  3. #include <iostream>
  4.  
  5. #if defined(_MSC_VER) && (_MSC_VER >= 1500) // Visual Studio 2008 or higher
  6. #include <random>
  7. #endif
  8.  
  9. #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 402) // GCC 4.2 or higher
  10. #include <tr1/random>
  11. #endif
  12.  
  13. typedef std::tr1::mt19937 Eng;
  14. typedef std::tr1::uniform_int<unsigned long> Dist;
  15. typedef std::tr1::variate_generator<Eng,Dist> Gen;
  16.  
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21. Eng eng((unsigned int)time(NULL));
  22.  
  23. Dist dist(0, 150000000);
  24. Gen gen(eng, dist);
  25.  
  26. cout << gen() << endl;
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
69387698