Page 1 of 1

Upcycler statistical bias

Posted: Sat May 03, 2025 4:03 am
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;
}

Re: Upcycler statistical bias

Posted: Sat May 03, 2025 5:03 am
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.

Re: Upcycler statistical bias

Posted: Sat May 03, 2025 2:32 pm
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).

Re: Upcycler statistical bias

Posted: Mon May 05, 2025 1:25 am
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.

Re: Upcycler statistical bias

Posted: Mon May 05, 2025 11:28 pm
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.