Skip to content

Commit

Permalink
add test case list helper for testing time-tag with random state.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Sep 6, 2022
1 parent 8b36697 commit be35dc6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions osu.Game.Rulesets.Karaoke.Tests/Helper/TestCaseListHelper.cs
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();
}
}
}

0 comments on commit be35dc6

Please sign in to comment.