Skip to content

Instantly share code, notes, and snippets.

@adriendumont
Forked from radarek/README.md
Last active August 29, 2015 14:22
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 adriendumont/cc1bd64255d21d3550b8 to your computer and use it in GitHub Desktop.
Save adriendumont/cc1bd64255d21d3550b8 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