From: William James Date: 2007-11-28T08:30:00+09:00 Subject: Re: Most elegant way to do this? On Nov 27, 8:34 am, Brian Adkins wrote: > Why be satisfied with a 10-12% increase in speed when we can have an > order of magnitude? :) The original poster didn't ask for the fastest possible implementation; you only imagined that he did. > > sudo gem install rubyinline This doesn't work at all. What were you imagining? > int roll(int n) { > int sum = n; > while (n-- > 0) { > sum += (rand() % 6); > } > return sum; > } That C-code is hideous. Let's compare it to something that isn't insanely low-level. function roll( n: integer ): integer; var i: integer; begin result := n; for i := 1 to n do result += random(6) end;