Posts Tagged ‘min’

C++ Generate random numbers in Range

Monday, June 8, 2009 17:06 No Comments

To make use of the rand() command you must include the cstdlib library #include <cstdlib> Before we generate a random number we call the srand(int) function to seed the randomizer so we dont get the same random number each time. #include <ctime> srand(time(NULL)); // time(NULL) returns seconds since 1.1.1970 To get the random number in [...]

This was posted under category: C++, Programming Tags: , , , , , , , , ,