Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Sorting file names randomly
- X-seq: zsh-users 12218
- From: Clint Adams <clint@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Sorting file names randomly
- Date: Sun, 18 Nov 2007 23:21:36 -0500
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <1050724064415.ZM20425@xxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20050723194240.GA32416@DervishD> <20050723212657.GA744@DervishD> <1050724064415.ZM20425@xxxxxxxxxxxxxxxxxxxxxxx>
On Sun, Jul 24, 2005 at 06:44:15AM +0000, Bart Schaefer wrote:
> A more efficient way might be this:
>
> function shuffle {
> emulate -L zsh
> declare -A h
> local +h -Z 5 RANDOM=$SECONDS
> integer i
> # set -- $~* # uncomment to use with noglob alias
> for ((i=1; i <= $#; ++i)) { h[$i.$RANDOM]=$argv[i] }
> reply=( $h )
> print -l $reply
> }
Is there any chance that prepending "$i." and hashing it will
decrease the randomness of the shuffle significantly?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author