Skip to content

Instantly share code, notes, and snippets.

@talbright
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talbright/0f71f2618dc65e08a514 to your computer and use it in GitHub Desktop.
Save talbright/0f71f2618dc65e08a514 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'yaml'
require 'zlib'
starting_bound = 368_796_583
ending_bound = 999_999_999
integers = []
ARGV[0].to_i.times { |x| integers << rand(starting_bound..ending_bound) }
serialized = YAML.dump(integers)
puts <<-EOT
length of #{ARGV[0]} integers is #{serialized.bytesize}
length compressed with zlib is #{Zlib::Deflate.deflate(serialized).bytesize}
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment