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. Advertising

  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. Advertising

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,478
    Lee Ryman
    Apr 26, 2005
  2. Pat Maddox

    sort_by{rand} doesn't shuffle array

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

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

    Array.shuffle/Array.shuffle!

    Jeff Moore, Aug 24, 2008, in forum: Ruby
    Replies:
    6
    Views:
    145
    Alexei Broner
    Oct 9, 2008
  5. Tuxedo
    Replies:
    8
    Views:
    125
    Tuxedo
    May 7, 2007
Loading...

Share This Page