0

how rand() works??

can you give some ease way to understand?

10th Feb 2017, 3:51 PM
Arthi T
Arthi T - avatar
1 Resposta
+ 2
One of the ways to generate pseudorandom number. #include <iostream> #include <ctime> using namespace std; static int z; int rand() { z=z*0x015a4e35+1; return (z>>10)&0x7fff; } int main() { z=time(0); cout << rand(); } It is difficult to understand.
10th Feb 2017, 4:23 PM
SUPER_S
SUPER_S - avatar