RandomComparer.cs 899 B

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