0
how rand() works??
can you give some ease way to understand?
1 Answer
+ 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.