| 3 | #include <common/random_select.h> |
| 4 | |
| 5 | bool random_select(double weight, double *tot_weight) |
| 6 | { |
| 7 | *tot_weight += weight; |
| 8 | if (weight == 0) |
| 9 | return false; |
| 10 | |
| 11 | return pseudorand_double() <= weight / *tot_weight; |
| 12 | } |
no outgoing calls
no test coverage detected