Created
July 6, 2018 04:06
-
-
Save aximov/3ff3bd8cf2df46be80443de75f2674ce to your computer and use it in GitHub Desktop.
同じシードで初期化されたrand48系関数は毎回同じ数列を返す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int i, seed; | |
double r; | |
seed = 1533627; | |
srand48(seed); | |
for (i = 0; i < 5; ++i) { | |
r = drand48(); | |
cout << r << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment