using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ObjectModel.Tool { /// /// 扑克牌的帮助类 /// public class PukeTool { /// /// ID转换为牌 /// /// /// /// public static void ConvertCard(int id, out int flower, out int num) { int temp = 0, tempint = 0; num = 0; flower = 0; temp = id % 54; if (temp == 0 || temp == 53) { flower = 5; num = temp == 0 ? 54 : 53; } else { tempint = temp % 13; if (tempint == 0) { flower = temp / 13; num = 13; } else { flower = temp / 13 + 1; num = tempint; } } } /// /// 打乱数组顺序 /// /// /// public static void ShuffleArray(ref T[] array, Random random) { int n = array.Length; int total = array.Length; while (n > 0) { n--; int k = random.Next(total); (array[k], array[n]) = (array[n], array[k]); } } } }