RandomComparer.cs 815 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.Sorting;
  4. using MediaBrowser.Model.Querying;
  5. namespace Emby.Server.Implementations.Sorting
  6. {
  7. /// <summary>
  8. /// Class RandomComparer.
  9. /// </summary>
  10. public class RandomComparer : IBaseItemComparer
  11. {
  12. /// <summary>
  13. /// Compares the specified x.
  14. /// </summary>
  15. /// <param name="x">The x.</param>
  16. /// <param name="y">The y.</param>
  17. /// <returns>System.Int32.</returns>
  18. public int Compare(BaseItem x, BaseItem y)
  19. {
  20. return Guid.NewGuid().CompareTo(Guid.NewGuid());
  21. }
  22. /// <summary>
  23. /// Gets the name.
  24. /// </summary>
  25. /// <value>The name.</value>
  26. public string Name => ItemSortBy.Random;
  27. }
  28. }