Action: Gosubrandom(chance, label ID A, label ID B)

Related Actions: gosub, goto, gotorandom, repeat, exitloop, exitevent
Related Events: label
See also: FKiSS, Events, Actions

gosubrandom(chance, label ID A, label ID B)

First defined in: FKiSS3
Processing immediately jumps from this action to one of the specified labels. When that label finishes, processing of the current event continues.
Which label is processed is determined randomly where chance is the percentage that label ID A will be chosen instead of label ID B.

chance

chance is a value between 1 and 100 and may be a number or a variable.

label ID A
label ID B

In FKiSS3, label ID A and label ID B may be label ID numbers or a variables representing label ID numbers.
In FKiSS4, label ID A and label ID B may be label IDs (number or symbolic name) or a variables representing label ID numbers.

Example:

;@ gosubrandom(50, 5, 7) ; 50% chance of calling subroutine at label 5; otherwise, call label 7.
;@ gosubrandom(Odds, ThisLabel, ThatLabel)