Random - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Iterator[Trees]

 Random
 generate a random tree

 Calling Sequence Random(n,format=fmt)

Parameters

 n - posint; number of internal nodes format=fmt - format of the tree

Options

 • format = A,C,D,E,LR,P,S,Z
 Specifies the format of the tree. The default is LR. See Iterator[Trees] for a description of the formats.

Description

 • The Random command generates a random tree in the selected format.

Examples

 > $\mathrm{with}\left(\mathrm{Iterator}:-\mathrm{Trees}\right)$
 $\left[{\mathrm{Conjugate}}{,}{\mathrm{Convert}}{,}{\mathrm{Random}}{,}{\mathrm{Transpose}}\right]$ (1)

Generate a random tree with thirty internal nodes in C format.

 > $\mathrm{Random}\left(30,\mathrm{format}=C\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccc}{0}& {1}& {2}& {1}& {1}& {1}& {1}& {1}& {1}& {2}& {3}& {2}& {3}& {3}& {3}& {3}& {4}& {4}& {5}& {5}& {5}& {5}& {2}& {0}& {1}& {2}& {2}& {3}& {3}& {2}\end{array}\right]$ (2)

Compatibility

 • The Iterator[Trees][Random] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.

 See Also