A faster implementation in a compiled language uses all the bits of the
random number generator, division with remainder being quicker than a
rng call.  In a Monte-Carlo simulation I'd arrange the sizes for shift
and mask.

   ts'1...@#50'
0.057766 8.39027e6

   ts'(10#50)#:(1e6%10)?...@#50^10' NB. 10 at a time
0.042978 9.44051e6

   <. 10 ^. 2 50 ^ 63 10  NB. j64-602
18 16

> Message: 5
> Date: Sun, 25 Apr 2010 07:18:15 -0700
> From: Roger Hui <[email protected]>
> Subject: Re: [Jprogramming] Random Numbers with interation
> To: Programming forum <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=iso-8859-1
> 
> Slightly more economical to do 1...@#50 or 1...@$50
> instead of ?1e6#50 .


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to