zsh-workers
 help / color / mirror / code / Atom feed
* Would this (o) be very difficult to add?
@ 2003-09-23 16:12 DervishD
  2003-09-23 16:55 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: DervishD @ 2003-09-23 16:12 UTC (permalink / raw)
  To: Zsh

    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/


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-09-28 18:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-23 16:12 Would this (o) be very difficult to add? DervishD
2003-09-23 16:55 ` Bart Schaefer
2003-09-24 14:01   ` DervishD
2003-09-27 11:18     ` DervishD
2003-09-27 20:22       ` Bart Schaefer
2003-09-28  9:25         ` DervishD
2003-09-28 17:46           ` Bart Schaefer
2003-09-28 18:48             ` DervishD

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).