Skip to content

Instantly share code, notes, and snippets.

View memetor's full-sized avatar

memetor memetor

  • Tokyo, Japan
View GitHub Profile
require 'set'
require 'benchmark'
# CHAR = ['0'..'9', 'a'..'z', 'A'..'Z'].map(&:to_a).reduce(&:+)
# seeds = 1000000.times.map {100.times.map {CHAR.sample}.reduce(&:+)}.join("\n")
# File.write('seeds.txt', seeds)
seeds = File.read('seeds.txt').split
Benchmark.bmbm do |x|
class Fixnum
def fizzbuzz
return 'FizzBuzz' if self % 15 == 0
return 'Buzz' if self % 5 == 0
return 'Fizz' if self % 3 == 0
self
end
end
puts (1..100).map(&:fizzbuzz).join("\n")