I've written this code using the library in C++.
# include <math.h>
# include <iostream>
# include <random>
double srand(){
std::uniform_real_distribution<double> distribution(0.0, 1.0);
std::random_device rd;
std::default_random_engine generator(rd());
return distribution(generator);
}
using namespace std;
int main(){
for(int i=0; i < 10; i++){
cout << srand() << endl;
}
}
But every time I run the code, I get this result:
0.687363 0.687363 0.687363 0.687363 0.687363 0.687363 0.687363 0.687363 0.687363 0.687363
Aucun commentaire:
Enregistrer un commentaire