File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Microsoft.DotNet.Interactive.AIUtilities.Tests
Microsoft.DotNet.Interactive.AIUtilities Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,15 @@ public class SamplingTest
12
12
public void can_shuffle_collection ( )
13
13
{
14
14
var src = Enumerable . Range ( 0 , 10 ) ;
15
- var shuffled = src . RandomOrder ( ) . ToArray ( ) ;
15
+ var shuffled = src . Shuffle ( ) . ToArray ( ) ;
16
16
shuffled . Should ( ) . NotBeInAscendingOrder ( ) ;
17
17
}
18
18
19
19
[ Fact ]
20
20
public void does_not_duplicate_items ( )
21
21
{
22
22
var src = Enumerable . Range ( 0 , 10 ) . ToArray ( ) ;
23
- var shuffled = src . RandomOrder ( ) . Distinct ( ) . ToArray ( ) ;
23
+ var shuffled = src . Shuffle ( ) . Distinct ( ) . ToArray ( ) ;
24
24
shuffled . Should ( ) . HaveCount ( src . Length ) ;
25
25
}
26
26
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ namespace Microsoft.DotNet.Interactive.AIUtilities;
5
5
6
6
public static class Sampling
7
7
{
8
- public static IEnumerable < T > RandomOrder < T > ( this IEnumerable < T > source )
8
+ public static IEnumerable < T > Shuffle < T > ( this IEnumerable < T > source )
9
9
{
10
10
var rnd = new Random ( ) ;
11
11
var list = new List < T > ( source ) ;
You can’t perform that action at this time.
0 commit comments