Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Would this (o) be very difficult to add?
- X-seq: zsh-workers 19128
- From: DervishD <raul@xxxxxxxxxxxx>
- To: Zsh <zsh-workers@xxxxxxxxxx>
- Subject: Would this (o) be very difficult to add?
- Date: Tue, 23 Sep 2003 18:12:13 +0200
- Mail-followup-to: Zsh <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: Pleyades
Hi all :)
Sometimes we want to do globbing and sort the output randomly:
when generating playlists, when generating image slideshows, etc...
So I've thought that it would be good if we can do:
print -l *(or)
print -l *(Or)
Please note that since the sort criteria is 'random', (o) and (O)
have exactly the same effect...
If you use qsort or something like that, a quite simple
pseudo-random (we want apparent chaos, not cryptographical quality)
order can be achieved using a comparison function that generates a
random integer and returns, for example, 'first is greater' if the
random integer is even, 'second is greater' if the random integer is
odd and 'equal' if the random integer is 0. In fact, if you use the
standard qsort behaviour, you can return the random integer minus the
randomize range, so it will be <0, 0 or >0 appropriately.
If this is not much bloat, I would love having such a glob
qualifier :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author