describe a flavor which chooses from a collection - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Random Objects : RandomTools package : Flavors : RandomTools/flavor/choose

RandomTools Flavor: choose - describe a flavor which chooses from a collection

Calling Sequence

choose(collection)

Parameters

collection

-

set, list, Matrix, Vector, Array, or table

Description

• 

The flavor choose selects one of the entries in a non-empty collection with equal probability.

  

This flavor can be used as an argument to RandomTools[Generate] or as part of a structured flavor.

• 

The flavor choose cannot select an element from a non-array table that has an indexing function.

Examples

withRandomTools:

Generatechoosea,b,c,d,e,f

e

(1)

GeneratechooseA,B,C,D

C

(2)

GeneratechooseArray10..12,15..17,13..15,i,j,k→i,j,k

12,16,13

(3)

Generatechoosetablea=b,c=d

b

(4)

seqGeneratechoose1,2|3,4,i=1..10

4,3,4,1,2,2,2,4,4,1

(5)

Matrix3,3,Generatechoose0,1,makeproc=true

010101100

(6)

See Also

Array, flavor[structured], indexfcn, list, Matrix, RandomTools, RandomTools[Generate], set, table, Vector


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam