Skip to content

Instantly share code, notes, and snippets.

View dgalarza's full-sized avatar

Damian Galarza dgalarza

View GitHub Profile
@dgalarza
dgalarza / Ruby IP Generator.rb
Created September 14, 2009 20:42
Simulate creating 10 random IP numbers, converted to Hexadecimal string
# Uses built in ruby functions to handle conversions etc
# Create 10 IPs
for ips in 1...10
ip = ""
#generate a random segment for each IP part (4 parts for each IP)
for segment in 1...4
ip += rand(255).to_s(16).upcase
end
puts ip
end