Hi Arnab, further to Pascal’s note I would suggest the following approach:
        Set the random seed for the RNG to a value you desire (see the Foreign 
Conjunction 9!:1 )
        Then call ?n as you wish to produce a sequence as many times as you wish

Repeat sequence above to reproduce from a preset seed, for example:

First run:
    9!:1 ] 3581         NB. Set RNG Seed to 3581

   ?8
2
   ?100 100 100
10 28 71
   ?8
5

Now repeat:
   9!:1 ] 3581          NB. Reset RNG Seed to 3581 again to reproduce above

   ?8
2
   ?100 100 100
10 28 71
   ?8
5

I believe (untested) this approach should produce the same results across your 
students devices.

Best, Rob

> On 7 Feb 2020, at 12:14 am, 'Pascal Jasmin' via Programming 
> <programm...@jsoftware.com> wrote:
> 
> The initial seed is the same each time you start J.
> ?. differs on 32 and 64 bit systems, with default generator.
>    On Thursday, February 6, 2020, 07:21:31 a.m. EST, Arnab Chakraborty 
> <damd...@gmail.com> wrote:  
> 
> Dear all,
> 
> For my class of about 30 students armed with JAndroid 901, I had planned to
> use ?. to generate a random matrix which should be same for everybody. To
> start with, I asked everybody to try
> 
> ?. 100
> 
> Some got 46, others got 93. No other values. Next, someone noticed that if
> they repeatedly type
> 
> ? 100
> 
> then many are getting the SAME sequence of "random" numbers. Hence my
> question:
> 
> 1) Is there a way to produce predictable "random numbers" across different
> machines (all running Jandroid 901_*, where the *'s may differ)?
> 
> 2) Is there some way to get the initial seed from, say,  the system time in
> millisecond (or something like that)?
> 
> Thanks a lot.
> 
> Arnab.
> 
> PS: BTW, my students are loving J!
> ----------------------------------------------------------------------
> 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