[Jprogramming] 32- & 64-bit PRNGs

Brian Schott schott.brian at gmail.com
Sat Oct 15 00:35:41 HKT 2011


I am not familiar with these algorithms and my reply may therefore be redundant.

A simulation book by Avery Law (and perhaps jointly with Kelton) gives
an RNG with the characteristics you require, but I cannot find my
copy, much to my disappointment. It was new in about 1995.

On Fri, Oct 14, 2011 at 8:33 AM, Zsbán Ambrus <ambrus at math.bme.hu> wrote:
> On Fri, Oct 14, 2011 at 1:08 PM, Ewart Shaw <ewartshaw at gmail.com> wrote:
>> I want to generate pseudorandom sequences that are the same for 32- & 64-bit J.
>> I need better statistical properties than the old linear congruential generator
>> as in 'roll' & 'deal' at   http://www.jsoftware.com/help/release/random.htm .
>
> Have you tried the other random generators the (9!:43) foreign makes
> available?  I'd guess some of them are the same for 32 and 64 bit J.
>
> If that fails,
>
>> I could implement the 32-bit MT19937 'by hand' in J
>
> I'd recommend against that: instead pull in a C library that
> implements that or some other random generator, such as GSL, with the
> J foreign interface (15!:).  If you have trouble with this, tell me
> and I'll try to help.
>
> You may still have to implement deal if you need it.  The case when
> the right argument isn't too large is implemented in GSL, but the case
> when the right argument is very large and its left argument is small
> isn't trivial.  If you need this latter case, one implementation can
> be found in the J source code: this is a very tricky algorithm using a
> sparse table; a different algorithm is given in Knuth chapter 3.4.2
> exercise 15.
>
> Ambrus
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
(B=)


More information about the Programming mailing list