File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
Algorithms.Tests/Shufflers Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 6
6
7
7
namespace Algorithms . Tests . Shufflers
8
8
{
9
- public static class LINQShufflerTests
9
+ public static class LinqShufflerTests
10
10
{
11
11
[ Test ]
12
12
public static void ArrayShuffled_NewArraySameSize (
13
13
[ Random ( 10 , 1000 , 100 , Distinct = true ) ]
14
14
int n )
15
15
{
16
16
// Arrange
17
- var shuffler = new LINQShuffler < int > ( ) ;
17
+ var shuffler = new LinqShuffler < int > ( ) ;
18
18
var ( correctArray , testArray ) = RandomHelper . GetArrays ( n ) ;
19
19
20
20
// Act
@@ -30,7 +30,7 @@ public static void ArrayShuffled_NewArraySameValues(
30
30
int n )
31
31
{
32
32
// Arrange
33
- var shuffler = new LINQShuffler < int > ( ) ;
33
+ var shuffler = new LinqShuffler < int > ( ) ;
34
34
var ( correctArray , testArray ) = RandomHelper . GetArrays ( n ) ;
35
35
36
36
// Act
@@ -46,7 +46,7 @@ public static void ArrayShuffled_NewArraySameShuffle(
46
46
[ Random ( 1000 , 10000 , 5 , Distinct = true ) ] int seed )
47
47
{
48
48
// Arrange
49
- var shuffle = new LINQShuffler < int > ( ) ;
49
+ var shuffle = new LinqShuffler < int > ( ) ;
50
50
var ( correctArray , testArray ) = RandomHelper . GetArrays ( n ) ;
51
51
52
52
// Act
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ namespace Algorithms.Shufflers
12
12
/// LINQ queries and lambda expressions in C#.
13
13
/// </summary>
14
14
/// <typeparam name="T">Type array input.</typeparam>
15
- public class LINQShuffler < T > : IShuffler < T >
15
+ public class LinqShuffler < T >
16
16
{
17
17
/// <summary>
18
18
/// First, it will generate a random value for each element.
@@ -21,10 +21,10 @@ public class LINQShuffler<T> : IShuffler<T>
21
21
/// </summary>
22
22
/// <param name="array">Array to shuffle.</param>
23
23
/// <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 )
25
25
{
26
26
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 ( ) ;
28
28
}
29
29
}
30
30
}
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ find more than one implementation for the same objective but using different alg
148
148
* [ MSD Radix Sort] ( ./Algorithms/Sorters/String/MsdRadixStringSorter.cs )
149
149
* [ Shufflers] ( ./Algorithms/Shufflers )
150
150
* [ Fisher-Yates Shuffler] ( ./Algorithms/Shufflers/FisherYatesShuffler.cs )
151
- * [ LINQ Shuffler] ( ./Algorithms/Shufflers/LINQShuffler .cs )
151
+ * [ LINQ Shuffler] ( ./Algorithms/Shufflers/LinqShuffler .cs )
152
152
* [ Sequences] ( ./Algorithms/Sequences )
153
153
* [ A000002 Kolakoski] ( ./Algorithms/Sequences/KolakoskiSequence.cs )
154
154
* [ A000004 Zero] ( ./Algorithms/Sequences/ZeroSequence.cs )
You can’t perform that action at this time.
0 commit comments