string - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

RandomTools Flavor: string

describe a random string

 Calling Sequence string(n) string(n, alphabet)

Parameters

 n - non-negative integer, or flavor describing a non-negative integer alphabet - string, or symbol indicating an alphabet

Description

 • The flavor string(n) describes a string of length n. The flavor string(n, alphabet) describes a string of length n, where the characters are selected from the given alphabet.
 • Maple generates the string by calling StringTools[Random]. That help page describes how the optional alphabet parameter is interpreted. The default alphabet is print.
 • This flavor can be used as an argument to RandomTools[Generate] or as part of a structured flavor.

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right):$

Generate a string of 30 characters.

 > $\mathrm{Generate}\left(\mathrm{string}\left(30\right)\right)$
 ${"\"y 5,8KN+hc%GK09m_-x*Y\left(YTx*7R"}$ (1)

Generate a list of 10 strings, each of a length between five and 15, and consisting of alphanumeric characters.

 > $\mathrm{Generate}\left(\mathrm{list}\left(\mathrm{string}\left(\mathrm{integer}\left(\mathrm{range}=5..15\right),\mathrm{alnum}\right),10\right)\right)$
 $\left[{"PYLR9k1yzmiKL"}{,}{"f6LmmfFAydhnl2f"}{,}{"4MJoY2Q"}{,}{"s0WdU"}{,}{"dEhIGQnsAHuTpQ"}{,}{"a5C8T6ha"}{,}{"3Q3tAsG3hZpFYsl"}{,}{"vt3PnWsh9KRS"}{,}{"AMfiAVlT"}{,}{"Q4vv8A"}\right]$ (2)

Compatibility

 • The RandomTools Flavor: string command was updated in Maple 2019.
 • The n and alphabet parameters were introduced in Maple 2019.
 • For more information on Maple 2019 changes, see Updates in Maple 2019.