Course Solutions Uncategorized (Solved) : Code Needs Modified Include Include Include Int Main Int N X Unsigned Int Seed Double R Pr Q38012894 . . . .

(Solved) : Code Needs Modified Include Include Include Int Main Int N X Unsigned Int Seed Double R Pr Q38012894 . . . .

 

Code that needs to be modified:

#include <stdio.h>

#include <math.h>

#include <stdlib.h>

int main()

{

int i,N,x;

unsigned int seed;

double R;

printf(“nEnter number of iterations and seed”);

printf(“n”);

scanf(“%i %u”, &N,&seed);

srand(seed);

  

for(i=0;i<N;i=i+1)

{

R=(double)rand()/RAND_MAX;

if (R<0.5)

x=x+1;

else

x=x-1;

}

printf(“Final location is “);

printf(“%d”,x);

printf(“n”);  

}

Question: Write a code that generates N=10000 pairs of randomnumbers. Call the first member of each pair x and the second membery, and plot the pair x,y as points in the x-y plane. What do youexpect to happen?

Historical Note: A defect in an early IBM random numbergenerator was discovered by considering random numbers as points(x1,x2,…) in an m-dimensional space.

******* please help!!! and only help if you know how to do it toyour best capability. please show

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post