Respect JOSHUA_SEED if set

Closes #4913
This commit is contained in:
Andrew Noyes 2021-06-09 16:21:50 -07:00
parent bcd7b5a36c
commit 04694a6f70
1 changed files with 2 additions and 1 deletions

View File

@ -51,9 +51,10 @@ namespace SummarizeTest
bool traceToStdout = false;
try
{
string joshuaSeed = System.Environment.GetEnvironmentVariable("JOSHUA_SEED");
byte[] seed = new byte[4];
new System.Security.Cryptography.RNGCryptoServiceProvider().GetBytes(seed);
random = new Random(new BinaryReader(new MemoryStream(seed)).ReadInt32());
random = new Random(joshuaSeed != null ? Int32.Parse(joshuaSeed) : new BinaryReader(new MemoryStream(seed)).ReadInt32());
if (args.Length < 1)
return UsageMessage();