On Sat, 2003-08-09 at 14:38, Robert P. J. Day wrote:
> On 9 Aug 2003, Bret Hughes wrote:
> 
> > On Sat, 2003-08-09 at 10:41, Robert P. J. Day wrote:
> > > 
> > >   as part of a shell script, i'd like to generate a random
> > > number (preferably an integer), but i'd like to do it in a
> > > POSIX-compliant way.
> > > 
> > >   AFAICT, using the $RANDOM variable is not POSIX-compliant --
> > > that variable is not defined in a strict POSIX shell.
> > > 
> > >   any other suggestions?  perhaps reading a number of bytes
> > > from /dev/urandom or something?
> > > 
> > > rday
> > 
> > 
> > here is one that turned up on a google search  uses /dev/urandom if it
> > exists.  Not sure about the POSIX stuff but the guts of the dd
> > if=/dev/urandom is down in the bottom if statement.
> > 
> > http://www.shelldorado.com/scripts/cmds/rand.txt
> 
> great googly moogly!  sure is a production just to get a random
> number.  i miss the $RANDOM variable already.
> 

Yep better get your snickers bar ready.

I was able to dd the /dev/urandom but was lost how to turn all those
funky chars into a number.  I still have not waded through it all but
probably will at somepoint.  There is definitely something for me to
learn in there.

Bret 


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to