From 4c8ccca59b1881418afa808cb3df486745d8d3ac Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Thu, 9 Jan 2025 17:17:47 -0600 Subject: [PATCH] Better, non-hacky solution --- lib/sponsors.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/sponsors.ts b/lib/sponsors.ts index a4000fd7c..7c14a5fcd 100644 --- a/lib/sponsors.ts +++ b/lib/sponsors.ts @@ -107,13 +107,9 @@ export function makeIconSets( const toPick = icons.map(icon => { return { icon: icon, - // Number of times we'd expect to see this, divided by number of times we saw it. Special cased for - // icons that have to show every time. Which kinda tells me the algorithm is broken, but this was - // enough to get things working for now. - error: - icon.topIconShowEvery === 1 - ? Infinity - : result.length / icon.topIconShowEvery / (sponsorAppearanceCount.get(icon) || 0.00001), + // Number of times we'd expect to see this, divided by number of times we saw it, assuming that we pick + // this one next. + error: (result.length + 1) / icon.topIconShowEvery / ((sponsorAppearanceCount.get(icon) || 0) + 1), }; }); toPick.sort((lhs, rhs) => rhs.error - lhs.error);