Skip to content

Instantly share code, notes, and snippets.

@copiousfreetime
Created October 8, 2025 04:40
Show Gist options
  • Save copiousfreetime/8329eb587f1a8dbfd00df8d204754fcc to your computer and use it in GitHub Desktop.
Save copiousfreetime/8329eb587f1a8dbfd00df8d204754fcc to your computer and use it in GitHub Desktop.
results = Hash.new { |h,k| h[k] = Hash.new(0) }
count = (ARGV.shift || 10).to_i
durations = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
puts "Running sleep(duration) #{count} times each"
durations.each do |duration|
count.times do
zzz = sleep(duration)
results[duration][zzz] += 1
end
puts "sleep(%0.2f) : 0 => %2d, 1 => %2d" % [duration, results[duration][0], results[duration][1]]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment