GeoGebra Script: On Click
Button icon is very convenient, but you may use object which is clickable.
This button has a script in "On Click" term:
(RandomBetween[1, 6], RandomBetween[1, 6])
Right click -> Object Properties -> Scripting