Ciao a tutti, forse ho trovato il modo di risolvere il problema che avevo con la gaussiana, sto utilizando la libreria <random> ma vengono fuori alcuni errori:
prova.cpp:15: error: ‘default_random_engine’ was not declared in this scope
prova.cpp:15: error: ‘default_random_engine’ was not declared in this scope
questo e` il codice.
// normal_distribution
#include <iostream>
#include <random>
#include <string>
using std::cout;
using std::endl;
using std::string;
int main()
{
const int nrolls=10000; // number of experiments
const int nstars=100; // maximum number of stars to distribute
default_random_engine generator;
normal_distribution<double> distribution(5.0,2.0);
int p[10]={};
for (int i=0; i<nrolls; ++i) {
double number = distribution(generator);
if ((number>=0.0)&&(number<=10.0)) ++p[int(number)];
}
cout << "normal_distribution (5.0,2.0):" << endl;
for (int i=0; i<10; ++i) {
cout << i << "-" << (i+1) << ": ";
cout << string(p[i]*nstars/nrolls,'*') << endl;
}
return 0;
}
grazie a tutti.