I won’t totally dismiss the idea of a “class closed” hook to mirror inherited/included, but not for this. Quack quack, motherfucker!
trials = []
10000.times{ trials << rand(6) }
trials.uniq.map do |u|
trials.select { |t| t.equal? u }.size
end.collect do |c|
c.to_f / trials.size
end
Here’s a quick-and-dirty calculation of the distribution of values over 10,000 trials of Ruby’s rand() method on the range 0-5, analogous to rolling of a 6-sided die. An example output would be:
#=> [0.1707, 0.161, 0.1695, 0.1654, 0.1659, 0.1675]
It’s not an overly-elegant or efficient implementation. How would you do it?
Someday I’d like to think I’ll be able to build some web design skills. But someday I’d like to be a lot of things, and there’s only so many days between here and there. When am I going to get my first book written? And will that be before or after I’m no longer a terrible software developer? :-)
"a girl’s measurements should be: pupil size in picas, warmth of breath in kelvin and diary page count. now, add it up and tell ((no one))."
_why
Line:
Taken inside Jeni’s Ice Cream on High Street in the Short North, May 2009.
Lighting in a bottles:
Taken inside Jeni’s Ice Cream on High Street in the Short North, May 2009.
"Whatever their future, at the dawn of their lives, men seek a noble vision of man’s nature and of life’s potential."
Foreward to The Fountainhead