Generate - Maple Help

RandomTools

 Generate
 generate a particular random object

 Calling Sequence Generate(expr)

Parameters

 expr - expression; defines the form of the random object

Description

 • The Generate(expr) function generates a particular random object that is determined by expr. The expr parameter is used to:
 * indicate a particular Maple type,
 * indicate a flavor template, where specific keywords describe the form of the returned random object, or
 * choose a random entry from a Maple data structure.
 The following list describes the Maple types, flavor templates, and data structures that are recognized by Generate. For more information about how to generate a random number that corresponds to one of these items, see the corresponding help page (RandomTools/flavor/).

 • The Generate function calls the Maple rand procedure.
 • The Generate function maps onto all objects that are not of type atomic.
 • This function is part of the RandomTools package, and so it can be used in the form Generate(..) only after executing the command with(RandomTools). However, it can always be accessed through the long form of the command by using the form RandomTools[Generate](..).

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right):$
 > $\mathrm{Generate}\left(\mathrm{integer}\right)$
 ${-104281139460}$ (1)
 > $\mathrm{Generate}\left(\mathrm{list}\left(\mathrm{float},3\right)\right)$
 $\left[{0.2342493224}{,}{0.1799302829}{,}{0.5137385362}\right]$ (2)
 > $\mathrm{Generate}\left(\left[\mathrm{negint},\mathrm{integer},\mathrm{float}\right]\right)$
 $\left[{-65655460113}{,}{-113591692544}{,}{0.2907448089}\right]$ (3)
 > $\mathrm{Matrix}\left(3,3,\mathrm{Generate}\left(\mathrm{rational}\left(\mathrm{denominator}=10\right),\mathrm{makeproc}=\mathrm{true}\right)\right)$
 $\left[\begin{array}{ccc}\frac{{1}}{{10}}& \frac{{9}}{{10}}& \frac{{2}}{{5}}\\ \frac{{4}}{{5}}& \frac{{1}}{{2}}& {-}\frac{{1}}{{5}}\\ {0}& \frac{{2}}{{5}}& \frac{{1}}{{5}}\end{array}\right]$ (4)
 > $\mathrm{Matrix}\left(3,3,\mathrm{Generate}\left(\mathrm{rational}\left(\mathrm{denominator}=10\right),\mathrm{makeproc}=\mathrm{true}\right)\right)$
 $\left[\begin{array}{ccc}{-}\frac{{1}}{{10}}& \frac{{3}}{{10}}& \frac{{3}}{{5}}\\ {-}\frac{{9}}{{10}}& {-}\frac{{2}}{{5}}& \frac{{3}}{{10}}\\ \frac{{2}}{{5}}& {-}\frac{{3}}{{10}}& {-}\frac{{3}}{{10}}\end{array}\right]$ (5)
 > $\mathrm{Vector}\left(4,\mathrm{Generate}\left(\mathrm{complex}\left(\mathrm{integer}\left(\mathrm{range}=1..100\right)\right),\mathrm{makeproc}=\mathrm{true}\right)\right)$
 $\left[\begin{array}{c}{67}{+}{78}{}{I}\\ {51}{+}{53}{}{I}\\ {12}{+}{19}{}{I}\\ {63}{+}{40}{}{I}\end{array}\right]$ (6)