Kinopy
devlog
Play today's puzzle

Random is not fair

A plain random generator kept repeating the same pairs, so a fair shuffle now grows several candidate plants a day and keeps the freshest.

A random pick is not a fair pick, and the count showed it. On 21 October 2026 I counted how often the daily pairs repeated, found that a few of them came back far too often, and wrote down a plan for a fair shuffle (#141). This post walks through the counting, the fix (#151), and a simulator that lets me check the fix without waiting for a year of dailies to pass.

The count

Issue #141 has the numbers for the dailies starting from 22 October, 706 days per mode, as they stood on 21 October. For Kompanion, those days used 2,436 pairs from a graph of 6,673 links, the median gap before a pair came back was 38 days, and there were 3,834 repeats within 14 days. The worst pair came up 99 times. In catKin, the worst pair came up 333 times.

The cause is that the generator picks pairs evenly from the neighbours of each word, so hub words win again and again. A hub is a word with many neighbours, and every neighbour is a way for a board to include it. Seeds repeated too. Kompanion had 90 seeds then and catKin had 109, so a seed returned about every three months.

The plan

The plan in the issue had seven steps, and the first ones became the fair shuffle:

  1. Give every plant a freshness score from 0 to 100.
  2. Grow about 12 candidate plants for each day and keep the freshest one that is inside the difficulty bands.
  3. Weigh each candidate pair down by its use count, so hubs stop winning.
  4. Add hard floors: no pair again within 45 days, and no seed again within 120 days, unless no candidate passes.

I merged the machinery that evening (#151, 22:27 Singapore time on 21 October). It added a ledger, read from the published files, that records the last day and the use count of each pair, tile word and seed.

The score

The score lives in scripts/shuffle/fresh.ts. A past use costs more the more recent it is and the more often it happened. The recency part falls off over decayDays: 180, which is about six months, and the count part reaches about 63% of its cost at eight uses. Recency carries 70% of a pair cost, and the count carries 30%.

const recency = Math.exp(-(day - use.last) / t.decayDays)
const count = 1 - Math.exp(-use.count / t.countScale)
return t.recencyShare * recency + (1 - t.recencyShare) * count

Then a plant’s pair, word and seed costs are combined with weights. Here are the weights on 21 October (#151) and on 8 November, after word families joined the score (#288, 31 October):

Cost21 October8 November
Pair0.850.70
Tile word0.100.10
Word familynone0.15
Seed0.050.05

pairFloorDays is 45 on both dates, and it is a soft floor. A pair under the floor weighs almost nothing in the search, so the search takes one only when no other link fits.

The hard block

In #151 I also ran a trial that blocked recent pairs outright, testing Kompanion for 90 days from 23 October:

RunRepeats under 45 daysTime per day
Plain generatorabout 1,0600.03 s
Soft floor3260.3 s
Hard block on recent pairs1889 s

The hard block cut the repeats further, but it made each day about 30 times slower than the soft floor, so the merged code keeps the soft floor. At the time, the Kompanion graph could not hold the full 45-day floor, so a bigger bag of seeds and links came next. That landed in #303 on 31 October, growing the Kompanion seeds from 90 to 468 and the graph from 6,673 to 9,084 links.

The seed floor from the plan did arrive, in the second seed rotation (#288 on 31 October), where a seed stays off its mode for 120 days. Its start date moved twice after that, and #308 set it to 4 November.

The simulator

To check repeats without waiting for the days to pass, scripts/sim/shuffle.ts simulates years of dailies and does not write a daily file. It starts from the published days before --from, so a pair from the real history still counts as a repeat, then it grows each day with the plain generator and with the shuffle, and compares the gaps. You run it like this:

npx tsx scripts/sim/shuffle.ts --modes kompanion --days 90

I ran it on 8 November 2026 for Kompanion, covering 90 days from 22 October with that day’s code and seed lists, so it simulates those days and does not read the live dailies from that range. Here is the output, with the names of the pairs left out and the counts kept:

MeasurePlain generatorFair shuffle
Distinct pairs1,6691,991
Median gap before a pair came back28 days59 days
5th percentile gap2 days8 days
Repeats under 14 days24737
Repeats under 45 days615167
Days with a pair under the floor88 of 9047 of 90
Most uses of one pair97
Plants grown per day1.028.5

The shuffle shifts every gap measure the right way. It does not reach zero, because the floor is soft and 47 of the 90 days still hold at least one pair that came back inside 45 days. It also takes more work. A day grows up to 12 candidates in each pass, and since #303 a day can fall back through several passes, so the shuffle grew 28.5 plants a day where the plain generator grew one.

Looking back

Almost none of this changed a published day. The one exception was 31 October, when I chose to replace that day’s live boards in #303. In the code on main, the shuffle starts on 4 November, the same date as the second seed rotation, and every day that was already published keeps the boards that players saw. The reason for that rule is in the post about the rule engine.

The next post is about how one puzzle can grow a different tree for every player.

Give it a go at kinopy.day and tell me whether a day felt fresh to you!