Skip to content

Commit 3539d86

Browse files
committed
Fix some naming conventions and removed void on Shuffle method
1 parent 6fff006 commit 3539d86

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Algorithms.Tests/Shufflers/LINQShufflerTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
namespace Algorithms.Tests.Shufflers
88
{
9-
public static class LINQShufflerTests
9+
public static class LinqShufflerTests
1010
{
1111
[Test]
1212
public static void ArrayShuffled_NewArraySameSize(
1313
[Random(10, 1000, 100, Distinct = true)]
1414
int n)
1515
{
1616
// Arrange
17-
var shuffler = new LINQShuffler<int>();
17+
var shuffler = new LinqShuffler<int>();
1818
var (correctArray, testArray) = RandomHelper.GetArrays(n);
1919

2020
// Act
@@ -30,7 +30,7 @@ public static void ArrayShuffled_NewArraySameValues(
3030
int n)
3131
{
3232
// Arrange
33-
var shuffler = new LINQShuffler<int>();
33+
var shuffler = new LinqShuffler<int>();
3434
var (correctArray, testArray) = RandomHelper.GetArrays(n);
3535

3636
// Act
@@ -46,7 +46,7 @@ public static void ArrayShuffled_NewArraySameShuffle(
4646
[Random(1000, 10000, 5, Distinct = true)] int seed)
4747
{
4848
// Arrange
49-
var shuffle = new LINQShuffler<int>();
49+
var shuffle = new LinqShuffler<int>();
5050
var (correctArray, testArray) = RandomHelper.GetArrays(n);
5151

5252
// Act

Algorithms/Shufflers/LINQShuffler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Algorithms.Shufflers
1212
/// LINQ queries and lambda expressions in C#.
1313
/// </summary>
1414
/// <typeparam name="T">Type array input.</typeparam>
15-
public class LINQShuffler<T> : IShuffler<T>
15+
public class LinqShuffler<T>
1616
{
1717
/// <summary>
1818
/// First, it will generate a random value for each element.
@@ -21,10 +21,10 @@ public class LINQShuffler<T> : IShuffler<T>
2121
/// </summary>
2222
/// <param name="array">Array to shuffle.</param>
2323
/// <param name="seed">Random generator seed. Used to repeat the shuffle.</param>
24-
public void Shuffle(T[] array, int? seed = null)
24+
public T[] Shuffle(T[] array, int? seed = null)
2525
{
2626
var random = seed is null ? new Random() : new Random(seed.Value);
27-
array = array.OrderBy(x => random.Next()).ToArray();
27+
return array.OrderBy(x => random.Next()).ToArray();
2828
}
2929
}
3030
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ find more than one implementation for the same objective but using different alg
148148
* [MSD Radix Sort](./Algorithms/Sorters/String/MsdRadixStringSorter.cs)
149149
* [Shufflers](./Algorithms/Shufflers)
150150
* [Fisher-Yates Shuffler](./Algorithms/Shufflers/FisherYatesShuffler.cs)
151-
* [LINQ Shuffler](./Algorithms/Shufflers/LINQShuffler.cs)
151+
* [LINQ Shuffler](./Algorithms/Shufflers/LinqShuffler.cs)
152152
* [Sequences](./Algorithms/Sequences)
153153
* [A000002 Kolakoski](./Algorithms/Sequences/KolakoskiSequence.cs)
154154
* [A000004 Zero](./Algorithms/Sequences/ZeroSequence.cs)

0 commit comments

Comments
 (0)