#!/usr/bin/ruby
=begin
bubble sort in php by detour@metalshell.com
Generate random numbers then sort them.
Ported to Ruby by Jeffrin Jose T
Licensed : GPL
=end
array_size = 100
x = 0
y = 0
z = 0
hold = 0
ran = Array.new(array_size)
while x < array_size
ran[x] = rand(1..1000)
x +=1
end
x = 0
while x < array_size
y = 0
while y < array_size
if ran[x] < ran[y]
hold = ran[x]
ran[x] = ran[y]
ran[y] = hold
end
y +=1
end
x +=1
end
=begin
while z < array_size
puts ran[z]
z +=1
end
=end