Electro.Crypto.PrivateKey.GenPrivateKey C# (CSharp) Method

GenPrivateKey() public static method

public static GenPrivateKey ( int maxNum, int bitsCount = DefaultBitsCount ) : PrivateKey
maxNum int
bitsCount int
return PrivateKey
        public static PrivateKey GenPrivateKey(int maxNum, int bitsCount = DefaultBitsCount)
        {
            var buff = new byte[bitsCount/8];
            while(true)
            {
                Singleton.Random.NextBytes(buff);
                var p = BigInteger.Abs(new BigInteger(buff));
                return new PrivateKey { Key = p, MaxNum = maxNum};
            }
        }