+ 1

What is the exact algorithm that the rand () function uses to get random numbers ?

So in c++ we can see a rand () function which genarates random numbers. It uses a seed value which used to genatate random numbers. So there must be some mathmetical mechanism which the random number is generated. My question is how does the rand () function generate these random numbers.

4th Dec 2018, 3:46 AM
kazi sujoy
kazi sujoy - avatar
2 odpowiedzi
+ 1
https://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/random_r.c;h=a393dd3c199b5b08a16f3044f2a3bc21f8e88410;hb=HEAD
4th Dec 2018, 4:06 AM
James
James - avatar
0
good reading
4th Dec 2018, 4:07 AM
James
James - avatar