SHARE
TWEET

Untitled

a guest Feb 17th, 2012 91 Never
  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
RAW Paste Data
Top