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 HTH Bret -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list