Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) RandomizeTimer

 

RandomizeTimer is random numbers code snippet to set a random seed using the computer timer. The function name comes from the QBasic command 'RANDOMIZE TIMER', which served the same purpose.

 

#include <cstdlib>
#include <ctime>
 
//From http://www.richelbilderbeek.nl/CppRandomizeTimer.htm
void RandomizeTimer()
{
  std::srand(std::time(0));
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict