I multiply the source, you (probably) multiply the output!
R, 66 35 bytes

-29 bytes thanks to digEmAll.

-2 bytes thanks to Giuseppe.



+0-&gt;A
x=!0:F
F=F+1
sample(F*x+!x,1)


Try it online!

Check the distribution for N=4.

The key is the rightwards assignment -&gt;. When the code is multiplied \$N\$ times, the first \$N-1\$ calls to sample will be assigned to A, and only the last call will be printed.

Original, more convoluted solution:

R, 66 bytes



T-&gt;TT
F=F+1
TT=0
`?`=function(x)if(x)sample(c(1,F),1,,c(1,F-1))
?T


Try it online!

Try it online (repeated 3 times)!

Uses two tricks: 1) call the main function of interest ?, so that we can call it without ending the program with a bracket, and 2) use variables T and TT, with code which starts with T and ends with ?T.

F is the iteration counter. ? is redefined as a function which takes a boolean argument: if the input of ? is TRUE (or T), it does the required random sampling; if the input is FALSE (or 0), it does nothing. The value of TT is defined as 0, so that ?T does the sampling but ?TT does nothing.

When the source is repeated, it looks like this:

T-&gt;TT
F=F+1
TT=0
`?`=function(x)if(x)sample(c(1,F),1,,c(1,F-1))
?TT-&gt;TT
F=F+1
TT=0
`?`=function(x)if(x)sample(c(1,F),1,,c(1,F-1))
?T


so the middle call ?TT outputs nothing but the final call ?T outputs the random result.