After googling a bit I couldn't find a simple way to use a shell command to generate a random decimal integer number included in a specific range, that is between a minimum and a maximum.
I read about /dev/random
, /dev/urandom
and $RANDOM
, but none of these can do what I need.
Is there another useful command, or a way to use the previous data?
Best Answer
In the POSIX toolchest, you can use
awk
:Do not use that as a source to generate passwords or secret data for instance, as with most
awk
implementations, the number can easily be guessed based on the time that command was run.With many
awk
implementations, that command run twice within the same second will generally give you the same output.