Public Function RandomString( _ Optional ByVal vMinLength As Variant _ , Optional ByVal vMaxLength As Variant _ , Optional ByVal vAlphabet As Variant _ ) As Variant
Rnd(-1) = 0.224007 RandomString(0, 16, CryptoAlphabet) = "DO" RandomString(0, 16, CryptoAlphabet) = "RDLBUK" RandomString(0, 16, CryptoAlphabet) = "PZKSLARUXWCZA" RandomString(10, 10, CryptoAlphabet) = "NUGPSZUDBZ" RandomString(10, 10, CryptoAlphabet) = "PD IRNGL " RandomString(10, 10, CryptoAlphabet) = "OGIYIQFMDX" RandomString(Null, Null, CryptoAlphabet) = "SQ YAHEJDCTXCSR" CryptoAlphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"Note: The call to the Visual Basic Rnd function in the above example seeds the Visual Basic random number generator so that the sample results can be reproduced. There is generally no need to call the Rnd function within your programs since Entisoft Tools initializes the Visual Basic random number generator once with "Randomize" statement.
RandomStringFast Function RandomVariant Function EveryCharacterOfType FunctionvMinLength: Minimum length of the random string that will be returned. vMinLength defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number.
vMaxLength: Maximum length of the random string that will be returned. vMaxLength defaults to 64 if it is missing or Null or cannot be fixed up to a number.
Function returns Null if vMinLength > (is greater than) vMaxLength.
vAlphabet: String containing that the characters that will be used to compose the random string. vAlphabet defaults to every character with an ASCII value between 0 and 255 inclusive if it is missing or Null or cannot be fixed up to a String.
Function returns an empty string if the alphabet vAlphabet is an empty string.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.