You cannot directly modify the base Biginteger class.
But, you can create an extension method on this class ; this way:
using System.Numerics;
public static class Extensions
{
public static int GenerateRandomPrimeNumber(this Biginteger bi)
{
}
}
For the usage:
Biginteger bi = BigInteger.Zero;
int myPrime = bi.GenerateRandomPrimeNumber();
Warning: extension methods work on instances, that's why I had to declare a BigInteger variable to get access to the GetRandomPrimeNumber() extension method. You cannot create a static method on the class itself if you do not have the original source code and can recompile.