NB. This trick works for me:

   SEED =: 2!:0 'head --bytes=8 /dev/random'

   256 #. x: a.i. SEED
6185367602794180201
   
> From: Jo van Schalkwyk <[email protected]>
> To: [email protected]
> Subject: [Jprogramming] Fwd: Newbie needs a little help with J under
>         Linux :)
> Message-ID:
>         <CAFPT93Qjgy4VTa
> [email protected]>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Hi All
> 
> I'd like to obtain a seed value (for a pseudorandom number generator)
> from
> /dev/random, but when I try:
> 
> RAND =: '/dev/random'
> read =: 1!:1
> seed =: read < RAND
> 
> ... I seem to get a null string. What am I doing wrong? (I'm using
> Ubuntu
> Linux v 12.10 and J701/2011-01-10/11:25).  In Perl (this works on my
> machine), I'd say:


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

Reply via email to