Skip to content

Commit 4e08fe5

Browse files
committed
Remove own shuffle() and use morelinq's
1 parent 02c88ba commit 4e08fe5

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

src/JoinRpg.Helpers/StaticCollectionHelpers.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,6 @@ public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> source)
6565

6666
public static IEnumerable<T> OrEmptyList<T>(this IEnumerable<T>? collection) => collection ?? Enumerable.Empty<T>();
6767

68-
public static IEnumerable<T> Shuffle<T>(
69-
this IEnumerable<T> source)
70-
{
71-
ArgumentNullException.ThrowIfNull(source);
72-
73-
var sourceArray = source.ToArray();
74-
75-
for (var n = 0; n < sourceArray.Length; n++)
76-
{
77-
var k = Random.Shared.Next(n, sourceArray.Length);
78-
yield return sourceArray[k];
79-
80-
sourceArray[k] = sourceArray[n];
81-
}
82-
}
83-
8468
public static IEnumerable<T> UnionUntilTotalCount<T>(
8569
this IReadOnlyCollection<T> alreadyTaken,
8670
IEnumerable<T> toAdd,

src/JoinRpg.Portal/Controllers/GameGroupsController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using JoinRpg.Data.Interfaces;
44
using JoinRpg.DataModel;
55
using JoinRpg.Domain;
6-
using JoinRpg.Helpers;
76
using JoinRpg.Portal.Controllers.Common;
87
using JoinRpg.Portal.Infrastructure;
98
using JoinRpg.Portal.Infrastructure.Authorization;
@@ -18,6 +17,7 @@
1817
using Microsoft.AspNetCore.Authorization;
1918
using Microsoft.AspNetCore.Http.Extensions;
2019
using Microsoft.AspNetCore.Mvc;
20+
using MoreLinq;
2121

2222
namespace JoinRpg.Portal.Controllers;
2323

0 commit comments

Comments
 (0)