Developer Documentation Library > UNICOM Intelligence Function Library > List functions > RandomPassword
 
RandomPassword
Returns a string whose content and length are selected randomly within the constraints specified by the parameters. This function is intended to be used to generate unpredictable passwords.
Syntax
RandomPassword([<value> [, <minimum> [, <maximum>]]])
Parameters
<value>
Type: Text
(Optional.) The characters allowed in the password. If <value> is omitted or empty, “0123456789” is used.
<minimum>
Type: Long
(Optional.) The minimum length of the password. If MinLength is omitted or is less than 1, the minimum length is set to 8.
<maximum>
Type: Long
(Optional.) The maximum length of the password. If MaxLength is omitted or is less than MinLength, the maximum length is set to MinLength.
(return)
Type: Text
A password whose content and length are selected randomly within the constraints specified by the parameters
Notes
If <value> begins with "[" and ends with "]", <value> is interpreted as a regular expression, which enables ranges of characters to be specified without listing them all explicitly. For example, "[0-9a-fA-F]" is equivalent to "0123456789abcdefABCDEF".
The selection is random, like SetRandomSeed, so the results are not reproducible.
This function has no effect on the randomization state of the calling program.
Example
The following script generates a password that is between 10 and 16 characters long and contains a random selection of digits and lowercase letters:
Dim MyPassword
MyPassword = RandomPassword("[a-z0-9]", 10, 16)
See also
List functions