title: generate N(0,1) using uniform(0,1) in R
body: <p>I am trying to generate N(0,1) using uniform(0,1) for a simulation but can't get the code to run.</p>
  
  <p>Firstly, my x is found by making X the subject for the CDF of normal followed by getting out the histogram. This is followed by imposing a normal curve to see if it fits. Below is my code.</p>
  
  <pre><code>sigma=1; mu=0
  u&lt;-runif(n)
  x&lt;-mu + sqrt(2*sigma(log(u*sigma*sqrt(2*pi))))
  hist(x, Freq=F)
  xpt&lt;-seq(-5,5,0.1)
  ypt&lt;-dnorm(xpt,0,1)
  lines(xpt,ypt,col=2)
  </code></pre>