choose

choose( numberToChoose, items… )

.

Arguments

numberToChoose

- The number of items to choose from the collection of items (without replacement)

items

- The collection of items to choose from

Returns

A new collection with the randomly selected items.

Example #1

Chooses three of the various words and then prints them out:


define items = choose(3, “hello”, “goodbye”, “world”, “mom”, “dad”)

foreach item in items

       print(“Selected: “ + item )

end foreach


Example #2

You could also have the words (or whatever you are choosing) in a collection:


define collection WordsType

       “hello”

       “goodbye”

       “world”

       “mom”

       “dad”

end collection

define words = create WordsType


define items = choose(3, words )

foreach item in items

       print(“Selected: “ + item )

end foreach