I am learning to program blockchain and i am using the code:
static void Main(string[] args)
{
try
{
Key privateKey = new Key(); // generate a random private key
PubKey publicKey = privateKey.PubKey;
Console.WriteLine(publicKey); // 0251036303164f6c458e9f7abecb4e55e5ce9ec2b2f1d06d633c9653a07976560c
Console.WriteLine(publicKey.GetAddress(Network.Main)); // 1PrBDFfAiwqxe2izPcTsj5t4Dn5pjbvtH6
Console.WriteLine(publicKey.GetAddress(Network.TestNet)); // n3zWAo2eBnxLr3ueohXnuAa8mTVBhxmPhq
var publicKeyHash = publicKey.Hash;
Console.WriteLine(publicKeyHash); // f6889b21b5540353a29ed18c45ea0031280c42cf
var mainNetAddress = publicKeyHash.GetAddress(Network.Main);
var testNetAddress = publicKeyHash.GetAddress(Network.TestNet);
Console.WriteLine(mainNetAddress); // 1PrBDFfAiwqxe2izPcTsj5t4Dn5pjbvtH6
Console.WriteLine(testNetAddress); // n3zWAo2eBnxLr3ueohXnuAa8mTVBhxmPhq
Console.ReadLine();
}
catch (Exception)
{
throw;
}
}
and when i run this, i get the following error pointing to the first line:
You must set the RNG (RandomUtils.Random) before generating random numbers
I know i have to set RNG as the error suggests but how do i do it?