title: How do I randomly generate an array of doubles with a mean of 0 and standard deviation of 1?
body: <p>for my homework assignment I'm to generate a set of numbers to a fixed point that allows for the mean to be 0 and the standard deviation to be 1. I've been mainly dealing with an array of doubles to attempt this but I'm not sure how to accomplish this.</p>
  
  <p>For generating the values, I've tried using Box Muller method but I still end up with a mean and standard deviation thats still off from the mark of mean = 1 and sd = 1 for standard normal distribution</p>
  
  <p>UPDATE: Okay, I just realized my mistake. For box muller, I mistyped the 2 for a 3 instead. Fixed the problem now. </p>
  
  <pre><code>//Create Standard Normal Distribution
  void std_find(double a[],double s[], int pop, int samp){//
      //generate random numbers for std normal
      double *p;
      p = a;
      //generate numbers in standard normal
      double numA = 0;
      double numB = 0;
      double PI = 3.14159;
      //Box_Muller
      for(int i = 0; i &lt; pop; i= i+2){
          numA = (rand() * 1)/(double)32767;
          numB = (rand() * 1)/(double)32767;
          *p = sqrt((double)-3 * (log(numB))) * cos((double)3* PI*numA);
          p++;
          *p = sqrt((double)-3 * (log(numB))) * sin((double)3 *PI*numA);
          p++;
      }
      double popMean = mean(a,(double)pop);
      //double popMean = (double)0;
      double popSD = sqrt(sampleV(a,pop));
      //double popSD = (double)1;
      cout &lt;&lt; "\nPopulation Mean of the std: " &lt;&lt; popMean;
      cout &lt;&lt; "\nPopulation Standard deviance of std: " &lt;&lt; popSD;
      //population created, now to create sample
      sample(a,s,samp,popMean,popSD);
      }
  </code></pre>