This commit is contained in:
john 2025-05-27 00:28:10 +02:00
parent def7767b94
commit 8ad4302ec8
13 changed files with 3902 additions and 4 deletions

View file

@ -0,0 +1,18 @@
namespace Femto.Modules.Blog.Emoji;
internal static partial class AllEmoji
{
public static IList<string> GetRandomEmoji(int count) => new Random().TakeRandomly(Emojis).Distinct().Take(count).ToList();
}
internal static class RandomExtensions
{
public static IEnumerable<T> TakeRandomly<T>(this Random rand, ICollection<T> collection)
{
while (true)
{
var idx = rand.Next(collection.Count);
yield return collection.ElementAt(idx);
}
}
}