In my python program, I have three variables a
, b
and c
. They are all floats, and may be positive or negative with no upper and lower bounds.
How would I go about devising a function that takes these variables as weights and randomly chooses a corresponding action (A
, B
& C
)?
Example:
a = 10
b = -2
c = 7
The function should perform A
most of the time, C
some times, and B
the least often.
The 'weighted random functions' I found on this site do not deal with negative weights.