22 Sep, 2010, bbailey wrote in the 21st comment:
Votes: 0
David Haley said:
It's kind of lame that shuffle and shuffle! don't appear in the Ruby documentation for Array… :thinking:


Runter said:
I was puzzled by that as well. I suspect it may not be available in all implementations of ruby.


shuffle and shuffle! were added, IIRC, in 1.9 (and backported to 1.8.7), and both are present in the 1.8.7 and 1.9 docs.
22 Sep, 2010, David Haley wrote in the 22nd comment:
Votes: 0
What version is documented on the link I gave, then?
22 Sep, 2010, bbailey wrote in the 23rd comment:
Votes: 0
David Haley said:
What version is documented on the link I gave, then?


1.8.6, the last 'pure' 1.8 version. 1.8.7 is all new-fangled 1.8+1.9 hybridish so ruby-doc.org left the default docs at 1.8.6.
22 Sep, 2010, Tyche wrote in the 24th comment:
Votes: 0
Runter said:
I suspect it may not be available in all implementations of ruby.


For the 1.8.6 fork you can use a gem called backports to get additional functions.
ruby -e 'require "backports";deck = (1..52).to_a; p deck; p deck.shuffle!; p deck.shuffle!'

The difference in distributions between a 52-card deck shuffled with the N^N versus N! is for practical game considerations negligible.
You can't manually shuffle a deck that fairly. ;-)
20.0/24