The Joshtra language has got the "fortune" block which allows you to define a set of statements could be executed, but only one among the listed statements will be extracted and then executed.
By default all the case statements have got the same extraction probability.
You can alter the probability specifying an integer
weight parameter greater than 1.
Where 1 is the default (implicit)
weight for each case statement.
fortune {
case [<weight1>]: {
<statement block 1>
}
case [<weight2>]: {
<statement block 2>
}
.....
case [<weightN>]: {
<statement block N>
}
}
Example:
fortune {
case 3: { # 75% of probability
output 'Good Morning!';
}
case 1: { # 25% of probability
output 'Good Night!';
}
}
Let me give credit to Massimiliano "TheDaemon" Cuzzoli for this language construction.