A long time ago I wrote about the Two Envelopes paradox.

Once you understand the solution, it's hard to see why the paradox is so controversial and so widely misunderstood. As Dominus beautifully explains here, the solution is:

There is a fundamental mistake in the reasoning of "50% chance of the sum in the
other envelope being larger". This statement is based on the assumption that the
sums are chosen in random uniformly from -inf to +inf (think about it, otherwise
how can we say that there is an exactly 50% chance of *any* number we see in one
envelope being the smaller amount). However, **there is no uniform random
distribution from -inf to +inf**. That is because in a uniform
distribution, the probability density function is constant, and an integral
from -inf to +inf over a constant doesn't converge. That's all there is to it.
Simple.

So back to the original question. When you open one of the envelopes and find some sum of money in there, does it pay you to switch ? It doesn't - because you don't know what algorithm / distribution is used to pick the numbers. The switching argument doesn't work because it is based on a fallacious assumption of a uniform distribution.