Exemple #1
0
 /// <summary>
 /// ��ȡָ�����͵������
 /// </summary>
 /// <param name="Enum">�����������ö������</param>
 /// <param name="MaxLength">��󳤶�</param>
 /// <returns>string</returns>
 public static string GetGuid(RandEnum Enum, int MaxLength)
 {
     return GetGuid(Enum, "GB2312", MaxLength);
 }
Exemple #2
0
 /// <summary>
 /// ��ȡָ�����͵������
 /// </summary>
 /// <param name="Enum">�����������ö������</param>
 /// <param name="Encode">����������ĵı���</param>
 /// <param name="MaxLength">��󳤶�</param>
 /// <returns>string</returns>
 public static string GetGuid(RandEnum Enum, string Encode, int MaxLength)
 {
     if (Enum == RandEnum.Chinese) return GetGuid(Encode, MaxLength);
     string Guids = "";
     for (int i = 1; i <= MaxLength; i++)
     {
         int MinInt, MaxInt, Num;
         Random Rand = new Random(GetGuid(9) + i * 1000);
         Num = (Enum == RandEnum.Blend) ? ((Rand.Next(0, 10) <= 4) ? (int)RandEnum.Numeric : (int)RandEnum.Letter) : (int)Enum;
         MinInt = Num == 0 ? 48 : 97;
         MaxInt = Num == 0 ? 57 : 122;
         Guids += IntToString(Rand.Next(MinInt, MaxInt));
         Rand = null;
     }
     return Guids;
 }
Exemple #3
0
 /// <summary>
 /// ��ȡ���������ö�ٶ�Ӧ������
 /// </summary>
 /// <param name="Enum">�����������ö������</param>
 /// <returns>int</returns>
 private static int RandInt(RandEnum Enum)
 {
     return (int)Enum;
 }