Skip to content

Instantly share code, notes, and snippets.

@s-osa
Created June 10, 2014 21:36
Show Gist options
  • Save s-osa/28a45b13903bcd0d7825 to your computer and use it in GitHub Desktop.
Save s-osa/28a45b13903bcd0d7825 to your computer and use it in GitHub Desktop.
require 'benchmark'
require 'securerandom'
require 'random_bell'
REPEAT = 10 ** 6
Benchmark.bmbm do |b|
b.report("Random "){ rand = Random.new ; REPEAT.times{ rand.rand } }
b.report("SecureRandom"){ REPEAT.times{ SecureRandom.random_number } }
b.report("RandomBell "){ rand = RandomBell.new ; REPEAT.times{ rand.rand } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment