Random number generator in C#
You may improve performance:

I would use the modulo operator instead of a function call you aren't benefiting from 100%. Math.DivRem returns a value (quotient) that you don't use. Same result:

var rem = a + b % mod;


Saves you a few unboxing operations and method call

Func&lt;int, int, int, int&gt; modular = (a, b, mod) =&gt;
{
    var rem = a + b % mod;

    if (rem &lt; minvalue)
        rem += minvalue;

    return rem;
};


Saves half the time? http://pastebin.com/XTaLCQh4