 RandomTools - Maple Programming Help

Home : Support : Online Help : Programming : Random Objects : RandomTools package : Commands : RandomTools/GetFlavor

RandomTools

 GetFlavor
 return the flavor definition

 Calling Sequence GetFlavor(flvr)

Parameters

 flvr - symbol; represents a flavor in the form of a procedure or module

Description

 • The GetFlavor(flvr) function, where flvr specifies a flavor that is  known to function Generate, returns the procedure or module that defines the behavior of the flavor.
 If the flavor is not recognized by Generate, an exception is returned.
 • This function is part of the RandomTools package, and so it can be used in the form GetFlavor(..) 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[GetFlavor](..).

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right):$
 > $\mathrm{AddFlavor}\left(A=\mathrm{rand}\left(1..20\right)\right):$
 > $\mathrm{Generate}\left(A\right)$
 ${15}$ (1)
 > $\mathrm{GetFlavor}\left(A\right)$
 ${\mathbf{proc}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{proc}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{builtin}}{=}{\mathrm{RandNumberInterface}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}{}\left({6}{,}{20}{,}{5}\right){+}{1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (2)
 > $\mathrm{GetFlavor}\left(\mathrm{posint}\right)$
 ${\mathbf{proc}}\left(\left\{{\mathrm{range}}{::}{\mathrm{posint}}{:=}{99999999989}\right\}{,}{}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (3)
 > $\mathrm{GetFlavor}\left(\mathrm{integer}\right)$
 ${\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{ModuleApply}}{,}{\mathrm{randIntExclude}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{Main}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (4)
 > $\mathrm{member}\left(A,\left[\mathrm{GetFlavors}\left(\right)\right]\right)$
 ${\mathrm{true}}$ (5)