Close
Close window
Generate - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

RandomTools

Generate

generate a particular random object

Calling Sequence

Generate(expr)

Generate(expr, opt)

Parameters

expr

-

expression; defines the form of the random object

opt

-

(optional) keyword option; makeproc

Description

The Generate(expr) function generates a particular random object that is determined by expr. The expr parameter is used to indicate a so-called flavor template, where specific keywords describe the form of the returned random object. For example, the choose flavor is used to 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/<topic>).

The Generate function calls the Maple rand procedure.

The Generate function maps onto all objects that are not of type atomic .

If the keyword makeproc (or equivalently, makeproc = true) is used, then Generate will return not the requested random object, but a procedure that disregards its arguments and returns such a random object. If you need to generate multiple of the same type of random object, then you can gain some efficiency by using this option and calling the generated procedure multiple times. If you know beforehand how many such values you will need, you can get the same efficiency by using the list flavor , list(flavor, n), and generating n values at once.

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

>

withRandomTools&colon;

>

Generateinteger

−104281139460

(1)
>

Generatelistfloat&comma;3

0.2342493224&comma;0.1799302829&comma;0.5137385362

(2)
>

Generatenegint&comma;integer&comma;float

−65655460113&comma;−113591692544&comma;0.2907448089

(3)
>

generatorGeneraterationaldenominator=10&comma;makeproc=true&colon;

>

generator

110

(4)
>

Matrix3&comma;3&comma;generator

9102545121502515110

(5)
>

Matrix3&comma;3&comma;generator

310359102531025310310710

(6)
>

Vector4&comma;Generatecomplexintegerrange=1..100&comma;makeproc=true

78+51I53+12I19+63I40+90I

(7)


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /