Skip to content

Instantly share code, notes, and snippets.

@bf4
Forked from radarek/README.md
Created October 22, 2015 03:31
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 bf4/72bc0533fc2103c2a404 to your computer and use it in GitHub Desktop.
Save bf4/72bc0533fc2103c2a404 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