[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new coreutil? shuffle - randomize file contents

From: Philip Rowlands
Subject: Re: new coreutil? shuffle - randomize file contents
Date: Thu, 2 Jun 2005 11:30:40 +0100 (BST)

On Thu, 2 Jun 2005, James Youngman wrote:

>I think the consensus is that the functionality belongs in "sort".
>Beyond that things are a bit less clear.  However, Paul put forward a
>proposed usage which adapts the current -k option (see
>Nobody made any comments suggesting that that wasn't a good way of
>doing things.
>> or that it would be good to have both, or is it still in question
>> whether either would be accepted?
>Both is probably uncalled for though I personally would put something
>like this in /usr/local/bin/shuffle:
>#! /bin/sh
>exec sort -k R -- "$@"

FWIW, I favour this solution for both sort and shuffle. Determining
behaviour via argv[0] (a la grep/egrep/fgrep) would also work.

Paul's statement:
> It's not as easy to implement as it sounds, I'm afraid; even if you
> can assume /dev/random or /dev/urandom.

is a slight concern, but I imagine the problems are applicable to *any*
shuffling utility. Is it that the app must guarantee all lines of a
non-seekable stdin must have an equal chance of any sort order?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]