LoginSignup
0
0

More than 5 years have passed since last update.

プログラムの引数にランダム数が欲しい時

Posted at

プログラムの引数にランダムな数が欲しい時がありますよね.
そんなときは,shufを使えばOKです.

shuf -i 0-128 -n 10

とやれば,0から128の数が10個出てきます.
ただ,これだと改行が入ってるんで,

shuf -i 0-128 -n 10 | tr '\n' ' '

とやれば,改行がスペースになって,引数として渡しやすくなります.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0