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

Online Help

All Products    Maple    MapleSim


RandomTools Flavor: string

describe a random string

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

withRandomTools:

Generate a string of 30 characters.

Generatestring30

\"y 5,8KN+hc%GK09m_-x*Y(YTx*7R

(1)

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

Generateliststringintegerrange=5..15,alnum,10

PYLR9k1yzmiKL,f6LmmfFAydhnl2f,4MJoY2Q,s0WdU,dEhIGQnsAHuTpQ,a5C8T6ha,3Q3tAsG3hZpFYsl,vt3PnWsh9KRS,AMfiAVlT,Q4vv8A

(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.

See Also

flavor/structured

rand

RandomTools

RandomTools[Generate]

string

StringTools[Random]