diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Common/Instancing/RandomSeedGenerator.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Common/Instancing/RandomSeedGenerator.cs index 2220c83bbd..5dc995ba36 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Common/Instancing/RandomSeedGenerator.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Common/Instancing/RandomSeedGenerator.cs @@ -20,6 +20,11 @@ public static class RandomSeedGenerator #endregion + /// + /// The seed that should be used for random number generation + /// + private static int? Seed = null; + #region Public Methods and Operators public static int GetRandomSeed() @@ -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