title: Writing a shuffle method in Ruby
body: <p>I'm quite new to learning ruby and I am working through Learn to Program by Chris Pine. One of the exercises he suggests to try out is that of writing a shuffle method (I am aware of the <code>#shuffle</code> method). So far, I have come up with this code, which seems to do the job: </p>
  
  <pre><code>array_to_shuffle = []
  puts "Give me a list of words to shuffle, press enter on an empty line for the result."
  input = gets.chomp
  
  while input != ""
    array_to_shuffle = array_to_shuffle.push(input)
    input = gets.chomp
  end
  
  def recursive_shuffle(array_to_shuffle, shuffled_array = [])
    return shuffled_array unless array_to_shuffle.size &gt; 0
    array_size = array_to_shuffle.size()
    random_number = rand(1..array_size)-1
    element_transfered = array_to_shuffle [random_number]
    shuffled_array = shuffled_array.push(element_transfered)
    array_to_shuffle.delete(element_transfered)
    recursive_shuffle(array_to_shuffle, shuffled_array)
  end
  
  puts recursive_shuffle(array_to_shuffle)
  </code></pre>
  
  <p>However, it is quite long-winded considering what it actually does. Is there any way I could improve on this?</p>