// Since nobody posted the modern C++ approach yet, #include <iostream> #include <random> int main() { std::random_device rd; // obtain a random number from hardware std::mt19937 gen(rd()); // seed the generator std::uniform_int_distribution<> distr(25, 63); // define the range for(int n=0; n<40; ++n) std::cout << distr(gen) << ' '; // generate numbers } // [Cubbi] [so/q/7560114] [cc by-sa 3.0] $Follow @igor_chubin cheat.sh