Upcycler statistical bias

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
h.q.droid
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Mon Nov 18, 2024 12:10 pm
Contact:

Upcycler statistical bias

Post by h.q.droid »

Recent posts about quality has reminded me of a problem I observed in quality production: if you afk for long enough and leave an upcycler running, there will be a significant bias in leftover products that strongly suggests the recycler output distribution being biased. Like when a blue chip upcycler clogs you can end up with a whole tank (I use legendary tanks for end-game upcyclers) of epic red chips and another tank of rare green chips.

Has anyone else noticed the same phenomenon?

When reversing the random number generator I did notice its algorithm being unorthodox, but I didn't find any statistical issue too serious. And sharing the quality RNG state with turret targeting should have eliminated regular intervals... Reposting the RNG code just in case:

Code: Select all

uint32_t getInt(uint32_t *state){
  uint32_t uVar1;
  uint32_t uVar2;
  uint32_t uVar3;
  
  uVar3 = *state;
  uVar1 = (uVar3 << 13 ^ uVar3) >> 19 ^ (uVar3 & 0xffffe) << 12;
  uVar3 = state[1];
  *state = uVar1;
  uVar2 = (uVar3 * 4 ^ uVar3) >> 25 ^ (uVar3 & 0xffffff8) << 4;
  state[1] = uVar2;
  uVar3 = state[2];
  uVar3 = (uVar3 * 8 ^ uVar3) >> 11 ^ (uVar3 & 0x7ff0) << 17;
  state[2] = uVar3;
  return uVar1 ^ uVar2 ^ uVar3;
}
User avatar
Khagan
Filter Inserter
Filter Inserter
Posts: 284
Joined: Mon Mar 25, 2019 9:40 pm
Contact:

Re: Upcycler statistical bias

Post by Khagan »

h.q.droid wrote: Sat May 03, 2025 4:03 am Recent posts about quality has reminded me of a problem I observed in quality production: if you afk for long enough and leave an upcycler running, there will be a significant bias in leftover products that strongly suggests the recycler output distribution being biased.
Don't forget that even an unbiased output will exhibit a random walk: on any given run, the imbalance is expected to grow as the square root of the number of samples.
NineNine
Filter Inserter
Filter Inserter
Posts: 386
Joined: Mon Oct 24, 2022 11:20 pm
Contact:

Re: Upcycler statistical bias

Post by NineNine »

That's to be expected. The longer you run the recyclers, the more likely it is you'll see this. That's basic probability (https://en.wikipedia.org/wiki/Probability), and it's further described by the Law of Large Numbers (https://en.wikipedia.org/wiki/Law_of_large_numbers) and Extreme Value Theory (https://en.wikipedia.org/wiki/Extreme_value_theory).
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Upcycler statistical bias

Post by DaveMcW »

Khagan wrote: Sat May 03, 2025 5:03 amDon't forget that even an unbiased output will exhibit a random walk: on any given run, the imbalance is expected to grow as the square root of the number of samples.
For a specific example, if you recycle 1 million processing units, each with a 50% chance to generate an advanced circuit, you would expect the deficit or surplus to be: sqrt(1000000 * 2 / π) = ±798 advanced circuits.
mrkev
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 23, 2025 9:44 pm
Contact:

Re: Upcycler statistical bias

Post by mrkev »

h.q.droid wrote: Sat May 03, 2025 4:03 am ... clogs you can end up with a whole tank (I use legendary tanks for end-game upcyclers) of epic red chips and another tank of rare green chips.
Thanks for the tip. I've been using wagons, but they have quite a small space compared to tanks, especially if you add some belts.
Attachments
vulcanus.png
vulcanus.png (3.71 MiB) Viewed 171 times
Post Reply

Return to “Gameplay Help”