I\'m new to programming.
I want to know exactly what rand() does.
Searching only yields examples on its usage. But none explain each step of how the function
Well, I believe rand is from the C standard library, not the C++ standard library. There is no one implementation of either library, there are several.
You could go somewhere like this page to view the source code for glibc, the c library used on most Linux distributions. For glibc you'd find it in source files under stdlib such as rand.c
and random.c
.
A different implementation, such as uClibc might be easier to read. Try here under the libc/stdlib folder.