Generates a random string of a given length from a named character set or a custom alphabet. Suitable for tokens, passwords, and identifiers.
length defaults to 16 (max 256). charset is one of alphanumeric (default), alphabetic, lowercase, uppercase, numeric, hex, ascii_printable. Provide alphabet to use a custom character set instead. Uses a cryptographically-strong generator. Non-deterministic.
Length of the string. Defaults to 16.
Named character set. Defaults to alphanumeric. Ignored if 'alphabet' is given.
Custom set of characters to draw from. Overrides 'charset'.