Skip to content

Instantly share code, notes, and snippets.

@ryaz
Created April 29, 2014 19:07
Show Gist options
  • Save ryaz/11409097 to your computer and use it in GitHub Desktop.
Save ryaz/11409097 to your computer and use it in GitHub Desktop.
def dice_rand
(1..10).inject(10) {|s,i| s + rand(6)}
end
def count_dice_avg(number)
res = Hash.new(0)
number.times { x = dice_rand; res[x] += 1}
res.sort_by {|k,v| v}.reverse
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment