Skip to content

Commit

Permalink
Use .NextInt64() when computing random TimeSpan. (#8382)
Browse files Browse the repository at this point in the history
Closes #8381
  • Loading branch information
henricj authored Apr 12, 2023
1 parent b24bcc1 commit 64a1edb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Orleans.Core/Utils/RandomTimeSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal static class RandomTimeSpan
public static TimeSpan Next(TimeSpan timeSpan)
{
if (timeSpan.Ticks <= 0) throw new ArgumentOutOfRangeException(nameof(timeSpan), timeSpan, "TimeSpan must be positive.");
return timeSpan.Multiply(Random.Shared.NextDouble());
return TimeSpan.FromTicks(Random.Shared.NextInt64(timeSpan.Ticks));
}

public static TimeSpan Next(TimeSpan minValue, TimeSpan maxValue)
Expand Down

0 comments on commit 64a1edb

Please sign in to comment.