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
I guess, THIS is what you are looking for. It contains the detailed explanation of random function, and simple C program to understand the algo.
Edit:
You should check THIS as well. A possible duplicate.