All other Tests are fine but I'm kinda stuck on this one.
https://exercism.org/tracks/csharp/exercises/dnd-character
the test checks if the Random numbers created by my Ability() Method matches the Distribution that is expected by the Faktors in the Dictionary declared in the Test times the min multiplicator and the max multiplicator, which are 200 and 300 respectively.
I calculated that the for loop in the test where my Distribution get's generated will run 324.000 times
Here is my Ability() Method
public static int Ability()
{
List<int> rolls = new List<int>();
int lowest = 6;
Random dice = new Random();
for (int i = 0; i < 4; i++)
{
int roll = (int)dice.NextInt64(1, 6);
if (roll < lowest)
{
lowest = roll;
}
rolls.Insert(i, roll);
}
rolls.Remove(lowest);
return rolls.Sum();
}
I plan on refactoring later
and these are some test results
Assert.InRange() Failure
Range: (200 - 300)
Actual: 554
Assert.InRange() Failure
Range: (200 - 300)
Actual: 540
Assert.InRange() Failure
Range: (200 - 300)
Actual: 527
I don't know how to make sure I land in the Distribution range required.