On 12/06/2013 02:26 AM, Bernhard Voelker wrote:
> On 12/06/2013 02:13 AM, Pádraig Brady wrote:
>> I suppose we could make -r require that -n is specified,
>> but I'm not sure.
> 
> Regarding this in the above context - no, because then you would
> have to specify -n1 when "picking 1 random item". Saving the user
> from typing -n1 seems to be _the_ reason for assuming n=1.

OTOH there may be cases where you don't know the number of items
beforehand, but you want shuf to output that number of random items
from the input regardless of repetitions:

  $ gen_data | shuf -r

Shuf will know the number of elements and may easily pick that
number incl. repetitions.

If you want to pick just one, you know it and it's easy to say -n1,
but it's not that easy in the above case.

Have a nice day,
Berny



Reply via email to