Ruby Use one thread for number generation

Use one thread to generate at least 1,000,000 random numbers.

#!/usr/local/bin/ruby

# this program uses one thread and will generate at least
# 1,000,000 random numbers

# class names must be capitalized, thus a constant

require 'socket'

class Gen

#   @@arr = Array.new    # @@ makes it known to methods
                        # used for class variables
   def rnd1(str, fin, arr)
      for i in str..fin
#        @@arr[i] = rand(1000) # 1000 is max int
         arr[i] = rand(1000) # 1000 is max int
         if i % 100000 == 0
            printf "i = %d\n",i 
         end
      end
   end
   def prt(arr)
      for i in 0..20
#        printf "arr[%d] = %d\n",i,@@arr[i] 
         printf "arr[%d] = %d\n",i,arr[i] 
      end
   end
end

class GenSock
   snd = UDPSocket.new   # receiving socket
   rec = UDPSocket.new   # sending socket
   rec.bind("ioa.ccec.unf.edu",23232)#from server to rec sorted
   snd.connect("ioa.ccec.unf.edu",32323) #to server unsorted data

end


# definitions must appear before invocation
arr = Array.new
mygen = Gen.new
mygen.rnd1(0, 1000000, arr)
mygen.prt(arr)
mysoc = GenSock.new