The issue has to do with the algorithm being used in J32 and J64 for mersenne 
twister (rng mode 2 which is default).  They are based on different specs 
(MT19933-32 vs MT19933-64), but both exist in the source code.  The "problem" 
is that they generate different streams based on whether they are compiled to 
32 or 64 bits.


It is possible to get the same random stream using gbflip algorithm (mode 1) in 
32 and 64 bit modes with:

   RawRnd31 
(] {. 2147483647 ,@:(17 b. ,. [ 17 b. >:@[ <.@%~ ]) [: (128!:4) 2 >.@%~ ])"0

on J64, and 

((] {. [: , [: }:("1) _3 ,\ [: 128!:(4) 3 * 2 >.@%~ ])"0)

on J32.

Its not too hard to build other RNGs that build on this result (in linked 
essay) including MT19933-32 but it won't be as fast as J's internal 
implementation of MT.



----- Original Message -----
From: Joe Bogner <joebog...@gmail.com>
To: programm...@jsoftware.com
Cc: 
Sent: Wednesday, October 29, 2014 11:20 AM
Subject: Re: [Jprogramming] 32 bit mersenne twister in 64 bit J

Ah, not without some form of process interop. A 64 bit app can't invoke a
32-bit dll

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384231(v=vs.85).aspx

On 64-bit Windows, a 64-bit process cannot load a 32-bit dynamic-link
library (DLL). Additionally, a 32-bit process cannot load a 64-bit DLL.
However, 64-bit Windows supports remote procedure calls (RPC) between
64-bit and 32-bit processes (both on the same computer and across
computers). On 64-bit Windows, an out-of-process 32-bit COM server can
communicate with a 64-bit client, and an out-of-process 64-bit COM server
can communicate with a 32-bit client. Therefore, if you have a 32-bit DLL
that is not COM-aware, you can wrap it in an out-of-process COM server and
use COM to marshal calls to and from a 64-bit process.

On Wed, Oct 29, 2014 at 10:46 AM, 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:

> I was hoping the 32 bit functions somehow exist, and there is an
> abracadabra that unlocks them, in 64 bit J.
>
>
> ----- Original Message -----
> From: Joe Bogner <joebog...@gmail.com>
> To: programm...@jsoftware.com
> Cc:
> Sent: Wednesday, October 29, 2014 7:08 AM
> Subject: Re: [Jprogramming] 32 bit mersenne twister in 64 bit J
>
> Pascal, is your question whether it's possible to call an older version of
> the j.dll? If so, I don't see why not. See
> http://jsoftware.com/wsvn/addons/trunk/general/misc/jdll.ijs for an
> example
> of calling j.dll. It seems like you would just need to point to the path of
> the older version
>
>
>
>
> On Tue, Oct 28, 2014 at 8:17 PM, 'Pascal Jasmin' via Programming <
> programm...@jsoftware.com> wrote:
>
> > 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



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

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

Reply via email to