On Nov 27, 8:34 am, Brian Adkins <lojicdot... / gmail.com> 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;