Skip to content

Instantly share code, notes, and snippets.

@alevchuk
Created January 24, 2011 23:06
Show Gist options
  • Save alevchuk/794176 to your computer and use it in GitHub Desktop.
Save alevchuk/794176 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
srand(123) # Seed Random Generator for Reproducibility
loop_connection = 1_000_000 + rand(1_000_000)
real_end = loop_connection + 10 + rand(500_000) # loop size is from 10 to 500k
def rand_128bits_in_hex
# Return string is between hex 1000_0000 and ffff_ffff
("10000000".hex + rand("ffffffff".hex - "10000000".hex)).to_s(16)
end
(loop_connection).times{puts rand_128bits_in_hex}
loop do
srand(124) # Re-Seed Random Generator to make a loop
(real_end - loop_connection).times{puts rand_128bits_in_hex}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment