The classic way to generate random numbers in C is:
srand(time(NULL));
int rand = rand();
I want to know the algorithm behind the pseudorandom number generation. How does the rand()
function work?
rand() behaves differently between macOS and Linux doesn't answer my question. It only answers the fact that implementation of rand()
maybe different according to systems. I'm looking for how it is generally implemented or about the general category of implementations.