tag 61267 notabug
close 61267
stop

comments below...

On 03/02/2023 22:31, k...@plan9.lol wrote:
hello

shuf -i option cannot handle negative numbers.
examples:
   $ shuf -i -10-20
   $ shuf -i 0--20

don't know if it's a bug or a feature.

The input range needs to be unsigned
as documented in the info manual.
It should be easy enough to shift to the desired range,
for example:

  $ shiftn() { sed "s/\$/$1/" | bc; }
  $ shuf -i 0-10 | shiftn -5
  3
  -2
  0
  5
  2
  -5
  4
  -1
  -3
  1
  -4

cheers,
Pádraig



Reply via email to