How does one write a Wolfram function which has a 25% chance of returning 1, a 50% chance of returning 2, and a 25% chance of returning 3?
Here is how the data structure might look like:
D = {(0.25, 1), (0.5, 2), (0.25, 3)}
So how do we write an
f[D_] := ...
with the property above? (Or if this is not the best/most idiomatic data structure for this type of problem, then feel free to dismiss it).