Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 17th, 2012  |  syntax: Ruby  |  size: 0.17 KB  |  views: 91  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/ruby
  2.  
  3. n = 25
  4. data = Array.new(n) {|i| i};
  5.  
  6. n.times do|i|
  7.   from = rand(n - i) + i
  8.   data[i], data[from] = data[from], data[i]
  9. end
  10.  
  11. puts data.inspect
clone this paste RAW Paste Data