Skip to content

Commit

Permalink
Update RandomHelper.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
laolarou726 committed Nov 12, 2023
1 parent c7dfa9d commit 863e444
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ProjBobcat/ProjBobcat/Class/Helper/RandomHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class RandomHelper
/// <param name="enumerable">一个有限的 <see cref="IEnumerable{T}" /> 。</param>
/// <returns> <paramref name="enumerable" /> 中的随机一项。</returns>
/// <exception cref="ArgumentNullException"></exception>
public static T RandomSample<T>(this IEnumerable<T> enumerable)
public static T? RandomSample<T>(this IEnumerable<T> enumerable)
{
var arr = enumerable.ToArray();
return arr.Length == 0 ? default : arr[RandomInteger(0, arr.Length - 1)];
Expand Down

0 comments on commit 863e444

Please sign in to comment.