12 probdist_pick(struct probdist
*pd
)
14 float total
= probdist_total(pd
) - PROBDIST_EPSILON
;
16 /* TODO: float random */
17 double stab
= fast_frandom() * total
;
18 //fprintf(stderr, "stab %f / %f\n", stab, total);
19 for (int i
= 0; i
< pd
->n
; i
++) {
20 //struct board b = { .size = 11 };
21 //fprintf(stderr, "[%s] %f (%f)\n", coord2sstr(i, &b), pd->items[i], stab);
22 if (stab
<= pd
->items
[i
])
26 fprintf(stderr
, "overstab %f (total %f)\n", stab
, total
);