I have data like this:
d = (
(701, 1, 0.2),
(701, 2, 0.3),
(701, 3, 0.5),
(702, 1, 0.2),
(702, 2, 0.3),
(703, 3, 0.5)
)
Where (701, 1, 0.2) = (id1, id2, priority)
Is there a pretty way to choose id2 if I know id1, using priority?
Func(701) should return:
1 - in 20% cases
2 - 30%
3 - 50%
Percent will be rough of course
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…