コード例 #1
0
        public async Task <Character> GetRandom()
        {
            var rng   = new Random();
            var total = await _characterManager.CountAsync();

            if (total <= 0)
            {
                return(null);
            }
            int random = rng.Next(0, total);

            return(await _characterManager.GetCharacterByListAsync(random));
        }