Vector2<double> GaussianDistribution2D::rand() const
{
  Matrix2x2<double> L;
  choleskyDecomposition(covariance, L, 1E-9*(covariance.trace()));
  Vector2<double> xRaw(randomGauss(), randomGauss());
  return L * xRaw;
}
Esempio n. 2
0
void ElectronSimulation::setVoltageValuesPostNoise(TrialDataSet& eSimData)
{
    for (int i = 0; i < 7; ++i)
    {
        eSimData.voltageValuesPostNoise[i] =  eSimData.voltageValuesPreNoise[i] 
                                            + randomGauss(0.0, electronicNoiseRMS);
    }
}
  std::complex<double>
  Random::randomGauss2d()
  {
    double r = randomGauss();
    double a = 2. * M_PI * random01();

    return std::complex<double>(r * cos(a), r * sin(a));
  }
Esempio n. 4
0
 ModelCreature::ModelCreature(const ModelParams& params) : Creature()
 {
     type = MODEL;
     modelIdx = params.modelIdx;
     colour = params.colour;
     size = randomGauss(params.sizeAverage, params.sizeStdDeviation);
     
     frequency = ofRandom(2, 5);
 }
 void 
 Random::init()
 {
   double * iEnd = gauss_ + gaussS_;
   for (double * i = gauss_; i != iEnd; ++i)
     *i = randomGauss();
   std::complex<double> * jEnd = gauss2d_ + gaussS_;
   for (std::complex<double> * j = gauss2d_; j != jEnd; ++j)
     *j = randomGauss2d();
   iEnd = uniform01_ + uniformS_;
   for (double * i = uniform01_; i != iEnd; ++i)
     *i = random01();
   iEnd = uniform11_ + uniformS_;
   for (double * i = uniform11_; i != iEnd; ++i)
     *i = random11();
 }
Esempio n. 6
0
double distributeGauss(double miu, double sigma) {
    return randomGauss(sigma=sigma, miu=miu);
}