Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Forked from radarek/README.md
Created January 2, 2016 19:07
Show Gist options
  • Save cheeyeo/93309d9d5faf8dc94b91 to your computer and use it in GitHub Desktop.
Save cheeyeo/93309d9d5faf8dc94b91 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
probability = $stdout.tty? ? (ENV["D"] || 10).to_i : 0
puts ARGF.read.chars.map { |c| rand(100) + 1 <= probability && c !~ /\s/ ? " " : c }.join
def fib n
if n < 3
1
else
fib(n-1) + fib(n-2)
end
end
p fib(34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment