How to generate random number in Bash?

前端 未结 11 1533
青春惊慌失措
青春惊慌失措 2020-11-27 09:33

How to generate a random number within a range in Bash?

11条回答
  •  时光说笑
    2020-11-27 10:18

    Try this from your shell:

    $ od -A n -t d -N 1 /dev/urandom
    

    Here, -t d specifies that the output format should be signed decimal; -N 1 says to read one byte from /dev/urandom.

提交回复
热议问题