HackerTube / Video

rand() Considered Harmful

aghuttun

rand() Considered Harmful

Stephan T. Lavavej's GoingNative 2013 talk explaining why calling rand() and using rand() % 100 is bad in C++, and how the C++11 <random> header does the job properly.

It is the standard reference for why rand() is broken in C++ and what to use instead.

3 Hacker News mentions · 2019–2025

Topics

  • C, C++, Rust, Go & systems languages
  • Probability & game theory

Watch on YouTube

Explore more videos