30 static std::default_random_engine e ;
32 static bool seeded = false ;
35 #if defined(G_WINDOWS)
36 std::random_device r ;
38 std::random_device r(
"/dev/urandom" ) ;
41 using seed_t = std::random_device::result_type ;
43 try { seed_1 = r() ; }
catch( std::exception & ) {}
45 auto tp = std::chrono::high_resolution_clock::now() ;
46 auto seed_2 =
static_cast<seed_t
>( tp.time_since_epoch().count() ) ;
50 std::seed_seq seq{ seed_1 , seed_2 , seed_3 } ;
55 std::uniform_int_distribution<unsigned int> dist( start , end ) ;
unsigned int rand(unsigned int start=0U, unsigned int end=32767)
Returns a random value, uniformly distributed over the given range (including 'start' and 'end'),...