TestContext.WriteLine($"Generated 1M uniform distributed random numbers in {stopwatch.Elapsed.Minutes} minute(s), {stopwatch.Elapsed.Seconds} second(s), and {stopwatch.Elapsed.Milliseconds} milliseconds.");
Thread.Sleep(TimeSpan.FromSeconds(10));// Warm-up phase of generator
stopwatch.Start();
for(uintn=0;n<data.Length;n++)
data[n]=awaitrng.NextNumber(dist);
stopwatch.Stop();
rng.StopProducer();
TestContext.WriteLine($"Generated 1M normal distributed random numbers in {stopwatch.Elapsed.Minutes} minute(s), {stopwatch.Elapsed.Seconds} second(s), and {stopwatch.Elapsed.Milliseconds} milliseconds.");
TestContext.WriteLine($"Generated 1M chi-square distributed random numbers in {stopwatch.Elapsed.Minutes} minute(s), {stopwatch.Elapsed.Seconds} second(s), and {stopwatch.Elapsed.Milliseconds} milliseconds.");
}
#endregion
#regionMath.NET
[Test]
[Category(TestCategories.PERFORMANCE)]
publicvoidComparisonMathNet1MUniform()
{
varrng=newXorshift(true);
vardata=newfloat[1_000_000];
varstopwatch=newStopwatch();
Thread.Sleep(TimeSpan.FromSeconds(10));// Warm-up phase of generator
stopwatch.Start();
for(uintn=0;n<data.Length;n++)
data[n]=(float)rng.NextDouble();
stopwatch.Stop();
TestContext.WriteLine($"Generated 1M uniform distributed random numbers by means of Math.NET in {stopwatch.Elapsed.Minutes} minute(s), {stopwatch.Elapsed.Seconds} second(s), and {stopwatch.Elapsed.Milliseconds} milliseconds.");
Thread.Sleep(TimeSpan.FromSeconds(10));// Warm-up phase of generator
stopwatch.Start();
for(uintn=0;n<data.Length;n++)
data[n]=(float)dist.Sample();
stopwatch.Stop();
TestContext.WriteLine($"Generated 1M normal distributed random numbers by means of Math.NET in {stopwatch.Elapsed.Minutes} minute(s), {stopwatch.Elapsed.Seconds} second(s), and {stopwatch.Elapsed.Milliseconds} milliseconds.");
}
[Test]
[Category(TestCategories.PERFORMANCE)]
publicvoidComparisonMathNet1MChiSquare()
{
varrng=newXorshift(true);
vardist=newChiSquared(4);
vardata=newfloat[1_000_000];
varstopwatch=newStopwatch();
Thread.Sleep(TimeSpan.FromSeconds(10));// Warm-up phase of generator
stopwatch.Start();
for(uintn=0;n<data.Length;n++)
data[n]=(float)dist.Sample();
stopwatch.Stop();
TestContext.WriteLine($"Generated 1M chi-squared distributed random numbers by means of Math.NET in {stopwatch.Elapsed.Minutes} minute(s), {stopwatch.Elapsed.Seconds} second(s), and {stopwatch.Elapsed.Milliseconds} milliseconds.");