Array.shuffle()?

Discussion in 'Ruby' started by James Edward Gray II, Sep 23, 2004.

  1. I've been wondering lately, is there any particular reason Array
    doesn't have a shuffle() method? I realize it's pretty simple to roll
    my own, but this seems useful in many situations so I'm surprised it's
    not part of the core. Any thoughts?

    James Edward Gray II
     
    James Edward Gray II, Sep 23, 2004
    #1
    1. Advertisements

  2. "James Edward Gray II" <> schrieb im Newsbeitrag
    news:...
    > I've been wondering lately, is there any particular reason Array
    > doesn't have a shuffle() method? I realize it's pretty simple to roll
    > my own, but this seems useful in many situations so I'm surprised it's
    > not part of the core. Any thoughts?


    I'd assume the reason is that there might be arbitrary many shuffle
    implementations with no obvious default implementation. I guess there are
    many algos that need shuffling with certain properties.

    Just a wild guess though...

    robert
     
    Robert Klemme, Sep 23, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    12
    Views:
    14,921
    Lee Ryman
    Apr 26, 2005
  2. j0ecanad1an80

    Shuffle method error

    j0ecanad1an80, Jun 19, 2006, in forum: Java
    Replies:
    4
    Views:
    841
  3. Joerg Schuster

    shuffle the lines of a large file

    Joerg Schuster, Mar 7, 2005, in forum: Python
    Replies:
    24
    Views:
    1,801
    paul koelle
    Mar 12, 2005
  4. Pat Maddox

    sort_by{rand} doesn't shuffle array

    Pat Maddox, Jan 3, 2006, in forum: Ruby
    Replies:
    4
    Views:
    217
    Mauricio Fernandez
    Jan 3, 2006
  5. Shuffle Array.

    , Jun 12, 2006, in forum: Ruby
    Replies:
    6
    Views:
    342
  6. Jeff Moore

    Array.shuffle/Array.shuffle!

    Jeff Moore, Aug 24, 2008, in forum: Ruby
    Replies:
    6
    Views:
    355
    Alexei Broner
    Oct 9, 2008
  7. PerlFAQ Server

    FAQ 4.48 How do I shuffle an array randomly?

    PerlFAQ Server, Jan 3, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    175
    PerlFAQ Server
    Jan 3, 2011
  8. Tuxedo
    Replies:
    8
    Views:
    276
    Tuxedo
    May 7, 2007
Loading...