Skip to content

Commit 9e52b14

Browse files
baffling-birthdays: fix flaky test (#2418)
1 parent 23fa9be commit 9e52b14

File tree

1 file changed

+4
-1
lines changed
  • exercises/practice/baffling-birthdays/.meta

1 file changed

+4
-1
lines changed

exercises/practice/baffling-birthdays/.meta/Example.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ private static DateOnly RandomBirthdate(int year)
99

1010
public static DateOnly[] RandomBirthdates(int numberOfBirthdays)
1111
{
12-
var year = Random.Shared.Next(1900, DateTime.Now.Year + 1);
12+
var year = Random.Shared.Next(1900, DateTime.Now.Year);
13+
if (DateTime.IsLeapYear(year))
14+
year -= 1;
15+
1316
return Enumerable.Range(0, numberOfBirthdays).Select(_ => RandomBirthdate(year)).ToArray();
1417
}
1518

0 commit comments

Comments
 (0)