I found a function for gbflip that converts the 64 bit random number stream into 2/3rds of J32's 32 bit stream. For mode 3, I can get a few common numbers, but can't guess a conversion.
For mode 2, as I understand it, the seed is a 19997 bit number coded as an array of smaller numbers (bytes). As I understand it, the 32 bit algorithm would make a 32 bit mapping of that seed to a 32 bit number even if it were compiled on 64 bits. The different 64 bit algorithm has no 32 bit conversion of result to the 32 bit algorithm. Its possible that on 64 bit systems, the 32 bit algorithm does need an extra machine word size check that fit might provide. I think Bill's suggestion is more related to modes other than 2, though in the case of MT there also needs to be an extra mode to reflect the 32 bit algorithm. On another note, since (128!:4) returns a 64 bit number on J-64 does this mean the upper bound documentation is outdated for modes 2 3 and 4? (It appears as though for mode 1, there is a direct mapping of 62 bit numbers to 31 bit) One option would be to change (128!:4) to return the 32 bit documented upper bounds of their functions, and then have special 64 bit modes for the current behaviour that would need updated documentation. ________________________________ From: Devon McCormick <devon...@gmail.com> To: J-programming forum <programm...@jsoftware.com> Sent: Friday, October 31, 2014 9:13 AM Subject: Re: [Jprogramming] 32 bit mersenne twister in 64 bit J Since there's already a way to specify the RNG to use, it might make sense to enhance this to include 32- and 64-bit versions rather than use fit. On Thu, Oct 30, 2014 at 12:14 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > That would be helpful. It would work for mode 3 (DX-1597-4d), and it > would make it possible to include MT19937-32 as mode 5 with unchanged > source for that algorithm for whatever compilation target. > > > > ________________________________ > From: bill lam <bbill....@gmail.com> > To: 'Pascal Jasmin' via Programming <programm...@jsoftware.com> > Sent: Thursday, October 30, 2014 11:15 AM > Subject: Re: [Jprogramming] 32 bit mersenne twister in 64 bit J > > > IMO it will be much simplier if you can persuade Roger Hui to > add an adhoc fit (!.) for ? such that it will generate 32-bit > random numbers even for 64-bit platforms. > > > > > Вт, 28 окт 2014, jprogramming написал(а): > > The algorithm for ? generation (mode 2 in NRG select) changed in J-64. > Is there a way to import j.dll functions so as to use the old version? > > > > see http://www.jsoftware.com/pipermail/programming/2014-June/037583.html > > > > > > That request aside, I was able to create some portable (32 and 64 bit > identical streams) random generation code. Some of which are quite fast. > > > > > http://www.jsoftware.com/jwiki/PascalJasmin/portable%20and%20possibly%20secure%20RNGs > > > > There are also some versions that may be applicable to cryptography. > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm