Skip to content

Instantly share code, notes, and snippets.

@jimweirich
Created March 31, 2009 13: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 jimweirich/88188 to your computer and use it in GitHub Desktop.
Save jimweirich/88188 to your computer and use it in GitHub Desktop.
fortune = 0
max = 1000000
for i in 1..max do
n = rand(100) + 1
if (n <= 50) then fortune = fortune - 1
elsif (n >= 51 && n <= 65) then fortune = fortune + 0
elsif (n >= 66 && n <= 75) then fortune = fortune + 0.5
elsif (n >= 76 && n <= 99) then fortune = fortune + 1
elsif (n == 100) then fortune = fortune + 2
else puts "#{i}: n:#{n}"
end
end
puts fortune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment