if (seed == 0)
{
seed = CalculateSeed(this.northHand.ToString() + this.southHand.ToString());
this.random = new Random(seed);
}
this.LoadCombinations();
}
static int CalculateSeed(string input)
{
// Calculate the SHA-256 hash
using (SHA256 sha256 = SHA256.Create())
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = sha256.ComputeHash(inputBytes);
// Convert the first 4 bytes of the hash to an integer and take modulus
int hashInteger = BitConverter.ToInt32(hashBytes, 0);
return hashInteger;
}
}
in SetupEvaluation
I am using the 2 hands concatenated as input, but perhaps you want to add it as an input field.
I recommend to seed the random function like this
in SetupEvaluation
I am using the 2 hands concatenated as input, but perhaps you want to add it as an input field.