I'm not following this thread closely, but Algorithm M in section 3.4.1 of TAOCP is a very fast way of generating normal deviates. It can be modified to support generating them in batches.
Knuth says (p. 113 of my 1969 edition) "a general-purpose subroutine based on Algorithm M will be a valuable part of any subroutine library". Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Brian Schott > Sent: Saturday, August 09, 2008 3:17 PM > To: Programming forum > Subject: Re: [Jprogramming] generating standard normal variates > > Viktor, > > Yes, your version seems clean. On my computer (which > is an old Mac running OSX) normalrand4 takes only 1/4 the > space of normalrand, but takes upwards of 5 times as much > time. Go figure? > > On Sat, 9 Aug 2008, Viktor Cerovski wrote: > > + > + I have rewritten a bit your Box-Mueller code into: > + > + normalrand4=:({.,)(2 1&o."1 [EMAIL PROTECTED]:@[EMAIL PROTECTED] * > [:%:[EMAIL PROTECTED]:@[EMAIL PROTECTED])@>[EMAIL PROTECTED]: > + > + by making it tacit and using > + 2 1&o."1 0 and * > + instead of > + (2&o.,.1&o.) and *"1 0 > + > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
