fork download
  1. #include <boost/random/random_number_generator.hpp>
  2. #include <boost/random/mersenne_twister.hpp>
  3. #include <iostream>
  4. #include <stdint.h>
  5. #include <time.h>
  6.  
  7. int main() {
  8. boost::mt19937 engine32;
  9. boost::mt19937_64 engine64;
  10. boost::random::random_number_generator<boost::mt19937, uint32_t> generator32(engine32);
  11. engine32.seed(static_cast<unsigned int>(time(0)));
  12. boost::random::random_number_generator<boost::mt19937_64, uint64_t> generator64(engine64);
  13. engine64.seed(static_cast<unsigned int>(time(0)));
  14. std::cout << "32-bit random value: 0x" << std::hex << generator32(std::numeric_limits<uint32_t>::max()) << std::endl;
  15. std::cout << "64-bit random value: 0x" << std::hex << generator64(std::numeric_limits<uint64_t>::max()) << std::endl;
  16. return 0;
  17. }
  18.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9: error: ‘mt19937_64’ is not a member of ‘boost’
prog.cpp:9: error: expected `;' before ‘engine64’
prog.cpp:10: error: ‘random_number_generator’ is not a member of ‘boost::random’
prog.cpp:10: error: expected primary-expression before ‘,’ token
prog.cpp:10: error: expected primary-expression before ‘>’ token
prog.cpp:10: error: ‘generator32’ was not declared in this scope
prog.cpp:12: error: ‘random_number_generator’ is not a member of ‘boost::random’
prog.cpp:12: error: ‘mt19937_64’ is not a member of ‘boost’
prog.cpp:12: error: expected primary-expression before ‘>’ token
prog.cpp:12: error: ‘engine64’ was not declared in this scope
prog.cpp:12: error: ‘generator64’ was not declared in this scope
stdout

Standard output is empty