FMRPROG wrote > I am generating random numbers from a normal distribution using > [snip] > > I need to optimize the speed WITHOUT using the rnorm function but have no > idea how to do this. I assume I should minimise what goes in the loop? > > Any help would be very much appreciated.
Looks like homework. Thus, only a hint: any time you create something one at a time with a loop, you almost certainly can create all "n" values by taking advantage of R's built-in vectorization. Every statement in your loops can be vectorized. -- View this message in context: http://r.789695.n4.nabble.com/optimizing-code-tp4677966p4677972.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.