-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test case list helper for testing time-tag with random state.
- Loading branch information
1 parent
8b36697
commit be35dc6
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
osu.Game.Rulesets.Karaoke.Tests/Helper/TestCaseListHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Helper | ||
{ | ||
public static class TestCaseListHelper | ||
{ | ||
private static readonly Random rng = new(); | ||
|
||
/// <summary> | ||
/// Random the order of the list. | ||
/// </summary> | ||
/// <param name="list"></param> | ||
/// <typeparam name="T"></typeparam> | ||
/// <returns></returns> | ||
public static IList<T> Shuffle<T>(IList<T> list) | ||
{ | ||
// see: https://stackoverflow.com/a/4262134 | ||
return list.OrderBy(_ => rng.Next()).ToList(); | ||
} | ||
} | ||
} |