<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,14 @@
 class Array
   
+  def randomize(limit = length)
+    choices = dup
+    returning([]) do |result|
+      [limit, length].min.times do
+        result &lt;&lt; choices.delete_at(Kernel.rand(choices.length))
+      end
+    end.compact
+  end
+  
   def uniq_with_block!(&amp;block)
     uniq_without_block!
     if block_given?</diff>
      <filename>lib/awesomeness/core_ext/array.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,4 +36,13 @@ class ArrayTest &lt; Test::Unit::TestCase
     a.pad!(4, 'x')
     assert_equal [1,2,3,'x'], a
   end
+  
+  def test_randomize_length
+    assert_equal 4, (1..10).to_a.randomize(4).length
+  end
+  
+  def test_randomize_with_fewer_options
+    a = [1,2,3]
+    assert_equal 3, a.randomize(10).length
+  end
 end
\ No newline at end of file</diff>
      <filename>test/core_ext/array_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7ddd68f539dcc2fb9fb11b7443df4cfae0f9ad4c</id>
    </parent>
  </parents>
  <author>
    <name>Brandon Keepers</name>
    <email>brandon@collectiveidea.com</email>
  </author>
  <url>http://github.com/collectiveidea/awesomeness/commit/eb7e4e9878999e75349c6dc226dac5a8ea613361</url>
  <id>eb7e4e9878999e75349c6dc226dac5a8ea613361</id>
  <committed-date>2009-01-05T11:09:01-08:00</committed-date>
  <authored-date>2009-01-05T11:01:47-08:00</authored-date>
  <message>Added Array#randomize</message>
  <tree>c071be5b307aa04f2f3f069ec1c928928b160bea</tree>
  <committer>
    <name>Brandon Keepers</name>
    <email>brandon@collectiveidea.com</email>
  </committer>
</commit>
