Question: How to make optional arguments in procedure?

In this procedure I roll x dies and request a sum of the dies, n.
I then specify the third argument, o, to be exactly, minimum or maximum, so that it generates random rolls until the sum matches the conditions of my third argument.
It then returns the roll in a list and the number of rolls needed to match the conditions.

 

sim:=proc(x,n,o) uses RandomTools:

sim(3, 12, exactly)

[5, 2, 5], 1

(1)

````

optional_argument.mw
Can I somehow make the third argument optional, with exactly being the default, so that I can enter only sim(3,12) to get a roll that is exactly 12?
I've written through this maplesoft document, but don't quite seem to understand how to make an optional argument in  this regard: https://fr.maplesoft.com/support/help/maple/view.aspx?path=parameter_classes

Any help in understanding this is appreciatet :)

Please Wait...