public static string RandomFastString(int length) { if (length == 1) { return("r"); } return("r" + RandomText.Generate(length - 1)); }
/// <summary> /// Generate a clean random string for things like image verification. /// Doesn't generates vowels and visually confusing numbers / characters to help keep things simple. /// </summary> /// <param name="length"></param> /// <returns>String</returns> public static string RandomEasyReadString(int length) { if (length == 1) { return("r"); } const RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Compiled; string result = "r" + RandomText.Generate(length - 1); result = Regex.Replace(result, @"[AEIFL1]", "t", options); result = Regex.Replace(result, @"[OU0L6J]", "x", options); return(result); }