Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated uses of random number generation in tests so that we log the … #2631

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public static class RandomSeedGenerator

#endregion

/// <summary>
/// The seed that should be used for random number generation
/// </summary>
private static int? Seed = null;

#region Public Methods and Operators

public static int GetRandomSeed()
Expand All @@ -44,10 +49,15 @@ public static int GetRandomSeed()
{
}

// Keep the randomness per hour instead of per day.
DateTime now = DateTime.UtcNow;
int seed = (now.Year * 10000) + (now.Month * 100) + now.Day + now.Hour;
return seed;
if (Seed == null)
{
// Keep the randomness per hour instead of per day.
DateTime now = DateTime.UtcNow;
Seed = (now.Year * 10000) + (now.Month * 100) + now.Day + now.Hour;
Console.WriteLine($"Generated seed for random number generator: {Seed}");
}

return Seed.Value;
}

#endregion
Expand Down