Skip to main content

Command Palette

Search for a command to run...

Random Number | Learn CPlusPlus

Published
•1 min read•View as Markdown
Random Number | Learn CPlusPlus

In C++, the "rand()" function generates pseudo-random numbers between 0 and RAND_MAX. To ensure different sequences, "srand()" initializes the random number generator with a seed. However, C++11 introduces <random> library, providing better randomness and more control. It offers various distributions like uniform, normal, and discrete. Developers should prefer <random> over rand() for modern C++ programming. If you want to explore more about Random Number, take a look at this blog.

More from this blog

Learncplusplus

40 posts