Task
The task is to write a program that outputs a consistent but otherwise arbitrary positive integer \$x\$ (so strictly greater than 0). Here's the catch: when the source is repeated \$N\$ times (the code is appended/concatenated \$N-1\$ to itself), the program should have a \$\dfrac{1}{N}\$ probability of outputting \$N\cdot x\$ and the remaining probability of \$\dfrac{N-1}{N}\$ of outputting \$x\$ unchanged.
Example
Let's assume that your initial source is XYZ
and produces the integer 3
. Then:
For \$N=2\$:
XYZXYZ
should output \$3\$ with a probability of \$\frac{1}{2}\$ (50% of the time) and \$2\cdot 3=6\$ with a probability of \$\frac{1}{2}\$ as well (50% of the time).For \$N=3\$:
XYZXYZXYZ
should output \$3\$ with a probability of \$\frac{2}{3}\$ (66.666% of the time) and \$3\cdot 3=9\$ with a probability of \$\frac{1}{3}\$ (33.333% of the time)For \$N=4\$:
XYZXYZXYZXYZ
should output \$3\$ with a probability of \$\frac{3}{4}\$ (75% of the time) and \$4\cdot 3=12\$ with a probability of \$\frac{1}{4}\$ (25% of the time)
and so on....
Rules
You must build a full program. The output has to be printed to STDOUT.
Your program, should, in theory, output each possible value with the probabilities stated above, but a slight deviation from this due to the implementation of random is fine (provided that the implementation is not of a different distribution - you can't use a normal distribution to save bytes).
The program should (again, in theory) work for an arbitrarily big value of \$N\$, but technical limitations due to precision are fine for large \$N\$.
The output must be in base 10 (outputting in any other base or with scientific notation is forbidden). Trailing / leading spaces and leading zeroes are allowed.
The initial source must (of course) be at least 1 byte long. You may not assume a newline between copies of your source. The program should not take input (or have an unused, empty input).
This is code-golf, so an answer's score is the length of the (original) source in bytes, with a lower score being better.
Note: This challenge is a (much) harder version of this one.