rand number generator with limits in ruby
Some notes:


Try to learn some functional programming, you shouldn't write Ruby as it were a low-level language (like C). Favor expressions over statements. My 2-cents on the matter, I hope it helps: http://www.slideshare.net/tokland/functional-programming-with-ruby-9975242
Let me show a simple example of using FP. The first 4 lines of your code could be written like this: arr = 980.times.map { (11..989).to_a.sample }
arr4 = []: Why? the next line assigns it to another expression. 
range.to_a.sample. That's very inefficient, better rand(range).


I'd write:

ranges = [0..9, 11..989, 990..1000]
output = ranges.flat_map do |range|
  range.map { rand(range) }
end.shuffle