Being old enough to have learned my electronics before the digital age, I wonder if it isn't time to reconsider shot noise as a source of random numbers. It has a forensic advantage in lottery draws, and monte-carlo simulations of fraught political topics like climate change, by taking the "pseudo" out of "pseudo-random".
For years the UK gov ran a device called ERNIE http://en.wikipedia.org/wiki/ERNIE#ERNIE to pick premium bonds (a savings scheme where the interest payable was put in a monthly draw). A device to generate binary digits from electronic noise would be so simple it ought to be fitted as standard to today's desktop computers. Failing that, if I had a serious need for true random numbers I'd experiment with an open microphone line using Audacity to save the number stream as a WAV. Need a reproducible number stream? With the amount of free storage space in the "cloud" (I currently have access to around 2 GB and I don't remember asking for it) why not just store it? I also have a 1TB disk drive, mostly lying empty. For initial experiments, there's already a site which stores the first 200M digits of pi, for hobbyists wanting to do Carl Sagan "Contact"-type research: http://www.angio.net/pi/piquery Aside: ought the hunt for meaningful sequences in pi to be called perimancy? :-) On Fri, Oct 14, 2011 at 8:30 PM, Zsbán Ambrus <[email protected]> wrote: > On Fri, Oct 14, 2011 at 2:33 PM, Zsbán Ambrus <[email protected]> wrote: >> On Fri, Oct 14, 2011 at 1:08 PM, Ewart Shaw <[email protected]> wrote: >>> I want to generate pseudorandom sequences that are the same for 32- & >>> 64-bit J. >> >> 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. > > Hmm, from a quick test, it seems Roger is right: none of the built in > generators give the same results on the 32-bit and 64-bit J. > > Let's use the random generation functions from GSL ( > http://www.gnu.org/software/gsl/ ) then. This example implements > roll, but not deal. > > > $ cat rngwrap.c > #include <gsl/gsl_rng.h> > > /* > Allocate a new random generator of the Mersenne Twister algorithm > and initialize it with the default seed. > */ > gsl_rng * > wrap_newrng(void) { > gsl_rng *g = gsl_rng_alloc(gsl_rng_mt19937); > return g; > } > > $ cat rngwrap.ijs > NB. random generator functions from GSL > rngobj=: <'./rngwrap.so wrap_newrng > x'15!:0$0 > rollint=: './rngwrap.so gsl_rng_uniform_int > x *c x'15!:0 rngobj;] > rollflo=: './rngwrap.so gsl_rng_uniform_pos > d *c'15!:0 (,<rngobj)"_ > roll=: rollflo`rollint`[:@.*"0 :[: > > $ gcc -Wall -O -fpic -lm -lgslcblas -lgsl -shared -o rngwrap.so rngwrap.c > $ jconsole rngwrap.ijs > roll (10$1e4),5$0 > 9997 1629 2826 9472 2316 4849 9574 7443 5400 7399 0.759944 0.658637 > 0.315638 0.804403 0.519672 > > > > Ambrus > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
