Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3941086
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:29:54+00:00 2026-05-20T00:29:54+00:00

for my homework assignment I’m to generate a set of numbers to a fixed

  • 0

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.

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

UPDATE: Okay, I just realized my mistake. For box muller, I mistyped the 2 for a 3 instead. Fixed the problem now.

//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 < 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 << "\nPopulation Mean of the std: " << popMean;
    cout << "\nPopulation Standard deviance of std: " << popSD;
    //population created, now to create sample
    sample(a,s,samp,popMean,popSD);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:29:55+00:00Added an answer on May 20, 2026 at 12:29 am

    A good general way to go about this is to generate numbers that follow a standard normal distribution (defined as a normal distribution with µ=0 and σ=1). Take a look at the Wikipedia article for the normal distribution, specifically the section that says “Generating values from normal distribution”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a homework assignment, we're to be turning the basicCompare method into something that
For a homework assignment I was given a Card class that has enumerated types
I have a homework assignment that I am supposed to write a http server
As part of a homework assignment, we are supposed to create an array that
In a recent homework assignment I've been told to use long variable to store
Our homework assignment asks us to prove that the Java LinkedList implementation is doubly-linked
I am doing a homework assignment that reads in a book. First, a line
This is a homework assignment, just for all that want to know. I'm writing
A homework assignment asks me to implement a program that counts the words in
I just had a homework assignment that wanted me to add all the Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.