od -N4 -An -i
works like this:

read four bytes (-N4)
treat them as raw binary (-An)
output them as a signed decimal integer (-i)

Additionally, this result will be 75 characters wide (padded with
spaces before the terminating newline), with an extra blank line at
the end.  It's a fixed-width-character tabular-format thing.

Since we are already using the shell, you can get rid of the
extraneous whitespace like this:

   2!:0 'echo `cat /dev/urandom|od -N4 -An -i`'

If you want an unsigned result, the man page suggests -D (or -t u4)
instead of -i.

FYI,

-- 
Raul

On Wed, Mar 13, 2013 at 11:20 AM, Brian Schott <[email protected]> wrote:
> Bill,
>
> Your approach produced the following results on my Mac OS X. Notice
> the two blank lines and the negative number result.
>
>    2!:0 'cat /dev/urandom|od -N4 -An -i'
>                 818045955
>
>
>    2!:0 'cat /dev/urandom|od -N4 -An -i'
>               -1293144445
>
>
>
> --
> (B=)
> ----------------------------------------------------------------------
> 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