mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
🧹 Code cleanup and XMLdoc fix
This commit is contained in:
parent
605db2b5a8
commit
16f0a8a869
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
namespace X10D.ListExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="IList{T}" />.
|
||||
/// Extension methods for <see cref="IList{T}" /> and <see cref="IReadOnlyList{T}" />.
|
||||
/// </summary>
|
||||
public static class ListExtensions
|
||||
{
|
||||
@ -21,12 +21,12 @@ namespace X10D.ListExtensions
|
||||
/// <paramref name="source" /> is <see langword="null" />.
|
||||
/// </exception>
|
||||
/// <example>
|
||||
/// <code lang="csharp">
|
||||
/// <code lang="csharp">
|
||||
/// var list = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
/// var number = list.Random();
|
||||
/// </code>
|
||||
/// </example>
|
||||
public static T Random<T>(this IReadOnlyList<T> source, System.Random? random = null)
|
||||
public static T Random<T>(this IReadOnlyList<T> source, Random? random = null)
|
||||
{
|
||||
if (source is null)
|
||||
{
|
||||
@ -35,15 +35,15 @@ namespace X10D.ListExtensions
|
||||
|
||||
random ??= RandomExtensions.Random;
|
||||
return random.NextFrom(source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reorganizes the elements in a list by implementing a Fisher-Yates shuffle.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The element type.</typeparam>
|
||||
/// <param name="source">The <see cref="IList{T}" /> to shuffle.</param>
|
||||
/// <param name="random">Optional. The <see cref="System.Random" /> instance to use for the shuffling.</param>
|
||||
public static void Shuffle<T>(this IList<T> source, System.Random? random = null)
|
||||
public static void Shuffle<T>(this IList<T> source, Random? random = null)
|
||||
{
|
||||
if (source is null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user