I like to use the following verb (in Linux/Unix/OSX)

    pgseed =: 3 : '9!:1 {. _2 (3!:4) (4?4){ host ''dd if=/dev/random 
bs=4 count=1'''

where "host" is -

    host =: [: 2!:0 '('"_ , ] , ' || true)'"_

    9!:0 ''
_1461532984
    pgseed ''
1+0 records in
1+0 records out

     9!:0 ''
_1718973160

    pgseed ''
1+0 records in
1+0 records out

     9!:0 ''
1094292408

Using the entropy pool (/dev/random) is much better than trying to use a 
date/time.


On 2011/11/04 15:05 , Andrew Pennebaker wrote:
> When I do ? 16, the sequence always begins the same way.
>
> How can I seed the random number generator with the system time?
>
>     ymdhmstojsec =. 13 : '0 24 60 60 #. ({: 3 {. y) , 3 }. y'
>     9!:0 ymdhmstojsec 6!:0 ''
> |rank error
> |       9!:0 ymdhmstojsec 6!:0''
>
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
> ----------------------------------------------------------------------
> 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