PPBA icon indicating copy to clipboard operation
PPBA copied to clipboard

Hello! I would like to know why 115 lines, 116 lines let the ‘probability’ compare with ‘r’?

Open Kitzzaaa opened this issue 4 years ago • 1 comments

屏幕截图 2022-01-16 150820

Kitzzaaa avatar Jan 16 '22 07:01 Kitzzaaa

Hi, Kitzzaaa. Let us assume the probabilities of three situations should be: 0.2:0.3:0.5. We can sample a value r from [0,1]. If r is in [0, 0.2], it should be the first situation. If r is in (0.2, 0.2+0.3=0.5], it should be the 2nd one. And if r is in (0.5, 0.5+0.5=1], it should be the 3rd one.

For get_probability, we get the partition for three situations (like 0.2:0.3:0.5). Then r is the value randomly sampled from [0,1]. And we make the decision as above.

theFool32 avatar Jan 16 '22 08:01 theFool32