예제 #1
0
 public static BigInteger[] RandomArray(int length)
 {
     BigInteger[] array = new BigInteger[length];
     for (int i = 0; i <= length - 1; i++)
     {
         array[i] = RandomBits.RandomInRange(0, BigInteger.Pow(2, 89) - 1);
     }
     return(array);
 }
예제 #2
0
        public static BigInteger RandomInRange(BigInteger min, BigInteger max)
        {
            RandomNumberGenerator rng = RandomNumberGenerator.Create();

            if (min > max)
            {
                var buff = min;
                min = max;
                max = buff;
            }

            // offset to set min = 0
            BigInteger offset = -min;

            min  = 0;
            max += offset;

            var value = RandomBits.RandomInRangeFromZeroToPositive(rng, max) - offset;

            return(value);
        }