合同法による乱数の発生
#include <bits/stdc++.h> | |
using namespace std; | |
int irand(int ir) { | |
int a = 5, c = 1, m = 16; | |
return (a * ir + c) % m; | |
} | |
int main() { | |
int r = 0; | |
for (int i = 0; i < 32; ++i) { | |
r = irand(r); | |
cout << r << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment