File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1701,10 +1701,14 @@ To perform <dfn>common matching logic</dfn>, given
1701
1701
1702
1702
<div algorithm>
1703
1703
To <dfn>fairly allocate credit</dfn> , given a [=list=] of doubles |credit| and an integer |value|:
1704
- 1. Multiply each entry in |credit| by |value|.
1705
1704
1. Let |sumCredit| be the sum of |credit|'s [=list/items=] .
1706
- 1. Let |rawNormalizedCredit| be the result of element-wise dividing each [=list/item=] in |credit| by |sumCredit|.
1707
- 1. Let |normalizedCredit| be |rawNormalizedCredit|, with each [=list/item=] rounded towards positive Infinity and converted to an integer.
1705
+ 1. Let |rawNormalizedCredit| be a new [=list=] .
1706
+ 1. Let |normalizedCredit| be a new [=list=] .
1707
+ 1. [=list/iterate|For each=] |item| of |credit|:
1708
+ 1. Let |rawNormalized| be |value| * |item| / |sumCredit|.
1709
+ 1. [=list/Append=] |rawNormalized| to |rawNormalizedCredit|.
1710
+ 1. Let |normalized| be |rawNormalized| rounded towards positive Infinity and converted to an integer.
1711
+ 1. [=list/Append=] |normalized| to |normalizedCredit|.
1708
1712
1. Let |shuffledFractionalIndices| be [=list/get the indices|the indices=] of |credit|, ordered randomly.
1709
1713
1. [=list/remove|Remove=] all indices |i| from |shuffledFractionalIndices| where |rawNormalizedCredit|[|i|] has no fractional part.
1710
1714
1. [=list/iterate|For each=] |index| of |shuffledFractionalIndices|:
You can’t perform that action at this time.
0 commit comments