#include <cstdlib>
#include <ctime>
#include <random>
#include <iterator>
#include <iostream>
int random_int( std::mt19937& rng, int low, int high )
{ return std::uniform_int_distribution<int>( low, high )(rng) ; }
int main()
{
// initialize random number generator with warm-up sequence
// somewhat elaborate because: 'nearly perfect pseudo random numbers'
std::srand( std::time(nullptr) ) ;
std::uint32_t r[ std::mt19937::state_size ] ;
for( std::uint32_t& n : r ) n = std::rand() ;
std::seed_seq sseq( std::begin(r), std::end(r) ) ;
std::mt19937 gen(sseq) ;
// generate and print out 20 random numbers in [0,9]
for( int i = 0 ; i < 20 ; ++i ) std::cout << random_int( gen, 0, 9 ) << ' ' ;
std::cout << '\n' ;
// generate and print out 10 random numbers in [55,72]
for( int i = 0 ; i < 10 ; ++i ) std::cout << random_int( gen, 55, 72 ) << ' ' ;
std::cout << '\n' ;
}
I2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjdGltZT4KI2luY2x1ZGUgPHJhbmRvbT4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbHVkZSA8aW9zdHJlYW0+CiAKaW50IHJhbmRvbV9pbnQoIHN0ZDo6bXQxOTkzNyYgcm5nLCBpbnQgbG93LCBpbnQgaGlnaCApCnsgcmV0dXJuIHN0ZDo6dW5pZm9ybV9pbnRfZGlzdHJpYnV0aW9uPGludD4oIGxvdywgaGlnaCApKHJuZykgOyB9CiAKaW50IG1haW4oKQp7CiAgICAvLyBpbml0aWFsaXplIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yIHdpdGggd2FybS11cCBzZXF1ZW5jZQogICAgLy8gc29tZXdoYXQgZWxhYm9yYXRlIGJlY2F1c2U6ICduZWFybHkgcGVyZmVjdCBwc2V1ZG8gcmFuZG9tIG51bWJlcnMnCiAgICBzdGQ6OnNyYW5kKCBzdGQ6OnRpbWUobnVsbHB0cikgKSA7CiAgICBzdGQ6OnVpbnQzMl90IHJbIHN0ZDo6bXQxOTkzNzo6c3RhdGVfc2l6ZSBdIDsKICAgIGZ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