using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Store.VirtualLogistics.Services; internal static class RandomNameHelper { private static readonly string[] Surnames = { "赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "褚", "卫", "蒋", "沈", "韩", "杨", "朱", "秦", "尤", "许", "何", "吕", "施", "张", "孔", "曹", "严", "华", "金", "魏", "陶", "姜", "戚", "谢", "邹", "喻", "柏", "水", "窦", "章", "苏", "潘", "葛", "奚", "范", "彭", "郎", "鲁", "韦", "昌" }; private static readonly string[] Titles = { "先生", "女士" }; private static readonly Random _random = new Random(); /// /// 随机获取 姓+先生/女士 /// public static string GetRandomName() { var surname = Surnames[_random.Next(Surnames.Length)]; var title = Titles[_random.Next(Titles.Length)]; return $"{surname}{title}"; } /// /// 批量随机获取 /// public static List GetRandomNames(int count) { var list = new List(count); for (int i = 0; i < count; i++) { list.Add(GetRandomName()); } return list; } }