rand.rb is a library for picking random elements and shuffling.
Overview
rand.rb adds new methods to Enumerable, Array, and Hash to:
return a random element (
pick,pick_index,pick_key,pick_valueand their destructive versions suffixed with!).arrange elements in new, random order (
shuffle,shuffle_hash_pairs,shuffle_hash).use above methods in convenient ways (
each_random,map_random).
It also provides these new facilities to String:
shuffle_chars, to arrange the characters of the string in new order.pick_byte,pick_charandpick_index, to return random bytes, characters or elements.
History
November 26, 2004: Initial version done as IRC collaboration project between kig and chris2.
November 29, 2004: First release 0.9.
December 15, 2004: 0.9 officially announced.
Getting it
You can download rand.rb at
http://chneukirchen.org/releases/rand-0.9.0.tar.gz.
Upstream source
You can get latest development releases using darcs by executing:
darcs get http://chneukirchen.org/repos/rand
darcs send is the preferred way to send patches, but mailing diffs
is fine too.
Authors
- Ilmari Heikkinen: Code and unit tests
- Christian Neukirchen: Documentation and housekeeping.
Please mail bugs, feature requests or patches to the mail addresses above or use IRC to contact the developers.
Copyright
Copyright © 2004 Ilmari Heikkinen
Parts Copyright © 2004 Christian Neukirchen
This work is licensed under the same terms as Ruby itself.