Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <random>
- #include <iostream>
- using std::random_device, std::mt19937, std::uniform_int_distribution,
- std::cout, std::endl;
- auto main() -> int
- {
- auto entropy = random_device(); // Provides a really random seed for the random number engine.
- auto bits = mt19937( entropy() ); // Standard mersenne_twister_engine pseudo random sequence.
- auto number_from = uniform_int_distribution( 10, 49 ); // Inclusive limits.
- for( int i = 0; i < 10; ++i ) {
- if( i > 0 ) { cout << ", "; }
- cout << number_from( bits );
- }
- cout << "." << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement