zsh-workers
 help / color / mirror / code / Atom feed
From: DervishD <raul@pleyades.net>
To: Zsh <zsh-workers@sunsite.dk>
Subject: Would this (o) be very difficult to add?
Date: Tue, 23 Sep 2003 18:12:13 +0200	[thread overview]
Message-ID: <20030923161213.GA772@DervishD> (raw)

    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/


             reply	other threads:[~2003-09-23 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-23 16:12 DervishD [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030923161213.GA772@DervishD \
    --to=raul@pleyades.net \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).