A quick and straightforward tutorial that demonstrates how to generate random numbers in C language.

You can use the same functions to work with C++.

The motivation came from the need of my programming students, especially from courses not directly linked with computer science, such as those of Electrical Engineering....


Random numbers are useful for a wide variety of situations, such as generating data encryption keys, simulating and modeling complex phenomena and selecting random samples from larger data sets.

Random numbers have also been used aesthetically, for example, in literature and music and for games and bets.

However, it is...