Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
std::rand draws a random positive integer from zero to RAND_MAX. RAND_MAX is a #defined in cstdlib.h.
std::rand is defined in the header file cstdlib.h.
std::_lrand is like std::rand, except it returns random numbers in a larger range. Check out the Boost C++ library for other random number generators.
As std::srand and std::rand use a global/static variable and therefore is not suitable for multithreading. The Boost C++ library has other random number generators that do support multithreading.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.