question about random number generation

This forum is to discuss the book "C++ design patterns and derivatives pricing."

question about random number generation

Postby DavidZhou » Sun Oct 04, 2015 10:12 am

i'm question about Gussian Random number generation. Page 5 in the book there is an Algorithm about Gussian random number generation, which is as follows:
double GetOneGussianBySummation(){
double result=0.0;
for(unsigned long j=0;j<12;j++)
return result;

can i understand above code in this way:
aasume that x=rand()/static_cast<double>(RAND_MAX); i can induce that x is a uniformly variable.further more,i can get Expection(result)=Exp(x00+...+x11-6)
=Exp(x00)+...+Exp(x11)-6=12Exp(x)-6=12*1/2-6=0 and Variance(result)=Var(x00+...+x11-6)=12Var(x)=12*1/12=1. as a result ,i can see varaible result's Exp and Var are 0 and 1 respectively.but according to function name GetOneGussianBySummation ,does that mean that result is a normal Variable?but i only konw its exp and var,i cant prove variable is a normal variable.
would y like to spare some time to explain it ?thanks a million.
Posts: 3
Joined: Sat Aug 09, 2014 12:04 pm
Location: Mainland China

Re: question about random number generation

Postby mj » Fri Oct 16, 2015 8:11 am

well if you add enough independent random variables together the distribution becomes approximately normal -- that's the Central Limit theorem.

So in this case, it's normal enough but it's not truly normal.
Site Admin
Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am

Return to C++ design patterns and derivatives pricing

Who is online

Users browsing this forum: No registered users and 2 guests