Skip to content

Commit

Permalink
Replace Shuffle implementation with the one provided by .NET
Browse files Browse the repository at this point in the history
  • Loading branch information
d4n3436 committed Jun 23, 2024
1 parent 2258126 commit 561fd99
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 43 deletions.
3 changes: 1 addition & 2 deletions src/Entities/FergunTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Fergun.Extensions;
using GTranslate;
using GTranslate.Results;
using GTranslate.Translators;
Expand Down Expand Up @@ -31,7 +30,7 @@ public FergunTranslator(IEnumerable<ITranslator> translators)
public string Name => nameof(FergunTranslator);

/// <inheritdoc/>
public void Randomize(Random? rng = null) => _translators.Shuffle(rng);
public void Randomize(Random? rng = null) => (rng ?? Random.Shared).Shuffle(_translators);

/// <inheritdoc />
public Task<ITranslationResult> TranslateAsync(string text, string toLanguage, string? fromLanguage = null)
Expand Down
19 changes: 0 additions & 19 deletions src/Extensions/ListExtensions.cs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Fergun.Tests/Entities/FergunTranslatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void FergunTranslator_Name_Returns_Type_Name()
[Fact]
public void FergunTranslator_Randomize_Shuffles_Translators()
{
_fergunTranslator.Randomize(new Random(1));
_fergunTranslator.Randomize(new Random(0));

Assert.NotSame(_innerTranslatorMock.Object, _fergunTranslator._translators[0]);
}
Expand Down
21 changes: 0 additions & 21 deletions tests/Fergun.Tests/Extensions/ListExtensionsTests.cs

This file was deleted.

0 comments on commit 561fd99

Please sign in to comment.