Org.BouncyCastle.Math.BigInteger.BigInteger C# (CSharp) Method

BigInteger() public method

public BigInteger ( int sizeInBits, Random random ) : System
sizeInBits int
random System.Random
return System
		public BigInteger(
			int		sizeInBits,
			Random	random)
		{
			if (sizeInBits < 0)
				throw new ArgumentException("sizeInBits must be non-negative");

			this.nBits = -1;
			this.nBitLength = -1;

			if (sizeInBits == 0)
			{
				this.sign = 0;
				this.magnitude = ZeroMagnitude;
				return;
			}

			int nBytes = GetByteLength(sizeInBits);
			byte[] b = new byte[nBytes];
			random.NextBytes(b);

			// strip off any excess bits in the MSB
			b[0] &= rndMask[BitsPerByte * nBytes - sizeInBits];

			this.magnitude = MakeMagnitude(b, 0, b.Length);
			this.sign = this.magnitude.Length < 1 ? 0 : 1;
		}

Same methods

BigInteger::BigInteger ( ) : System
BigInteger::BigInteger ( byte bytes ) : System
BigInteger::BigInteger ( byte bytes, int offset, int length ) : System
BigInteger::BigInteger ( int sign, byte bytes ) : System
BigInteger::BigInteger ( int sign, byte bytes, int offset, int length ) : System
BigInteger::BigInteger ( int bitLength, int certainty, Random random ) : System
BigInteger::BigInteger ( int signum, int mag, bool checkMag ) : System
BigInteger::BigInteger ( string value ) : System
BigInteger::BigInteger ( string str, int radix ) : System