/// <summary> /// Generates the string. /// </summary> /// <param name="minLength">Length of the min.</param> /// <param name="maxLength">Length of the max.</param> /// <param name="complexity">The complexity.</param> /// <returns>The random string</returns> /// <externalUnit/> /// <revision revisor="dev01" date="1/29/2010" version="1.1.6.1"> /// Member Created /// </revision> public string GenerateString( int minLength, int maxLength, StringComplexity.Complexity complexity) { return (this.GenerateString( SequoiaRandom.RandomNumber(minLength, maxLength), complexity)); }
/// <summary> /// Generates the string. /// </summary> /// <param name="length">The length.</param> /// <param name="complexity">The complexity.</param> /// <returns>The random string</returns> /// <externalUnit/> /// <revision revisor="dev01" date="1/29/2010" version="1.1.6.1"> /// Member Created /// </revision> public string GenerateString( int length, long complexity) { StringBuilder tempString = new StringBuilder(length); var categoryList = StringComplexity.ProcessComplexity(complexity); var restOfCategories = StringComplexity.ProcessComplexity(complexity); StringComplexity.Categories category; byte[] bytesHolder = SequoiaRandom.RandomBytes(length); Array listOfCategories = Enum.GetValues(typeof(StringComplexity.Categories)); foreach (byte letter in bytesHolder) { int index = 0; if (categoryList.Count > 0) { index = SequoiaRandom.RandomNumber( 0, categoryList.Count - 1); category = categoryList[index]; categoryList.RemoveAt(index); } else { index = SequoiaRandom.RandomNumber( 0, restOfCategories.Count - 1); category = restOfCategories[index]; } char character = this.GetCharacter(letter, category); tempString.Append(character); } return(tempString.ToString()); }