https://www.alexirpan.com/2015/09/09/the-other-two-envelope-...
If your solution is the same as this article's, it's plain wrong. Even the natural number case is plain strong.
It's very easy to demostrate as well: consider a trivia case where the distribution is just {P(1)=1/3, P(2)=1/3, P(3)=1/3} and you see 2 in the first envelope. There is no strategy to get a better chance than 50%. Therefore, any strategy that gives a better chance than 50% must implicitly make an assumption over the initial distribution (and therefore excludes a distribution like {P(1)=1/3, P(2)=1/3, P(3)=1/3})
Actually the article is even "wronger" than this, because "started A" and "switched" aren't independent and one can't simply use the product of their probability. The above example is a quick way to demonstrate it's not a general strategy without assumption to get >50% winning chance. Similarily, one can just use {P(1)=1/3, P(2)=1/3, P(3)=1/3} (this is a valid distribution over real numbers!) to demonstrate the real number strategy isn't general.
Again, for both natural number and real number case, the discussion over strategies is only meaningful is we know something about the distribution.
Interestingly, this article is wrong more or less in the same way as believing switching does give you more expected value in the original "twice money in another envelope" variation.
Edit: For people who are interested in the switching strategy, check Randomized Switching in the Two-Envelope Problem (2009). Spoiler: full of discussion over the initial distribution.
Sorry, but you're simply wrong. You can read the answer I gave. You can read the answer Colin Wright gave. You can trust that we both have math degrees and know what we are talking about. Or, aw heck, you can try it with an actual program at https://www.perlmonks.org/?node_id=39630. (Yes, I wrote that piece of hackery about a decade ago.)
I don't actually care how you convince yourself. But the explanation is right. If your random number is outside of the range, you've got even odds. If it is inside of the range, you've got 100% odds. As long as there is a positive probability of being between, you've got strictly better than even, by half of the probability of being between.
Many, many distributions guarantee positive odds of being in between. The one I chose for my program was:
(log(rand) * (flip_coin() ? 10 : -10 ))
Which is the log of a random number between 0 and 1, times 10 times + or - with even odds. The various factors were chosen to fit well with normal human choices that most seek to test it with.Edit Edit: I was wrong. I completely misunderstood the problem. See my other comment below.
> It's very easy to demostrate as well: consider a trivia case where the distribution is just {P(1)=1/3, P(2)=1/3, P(3)=1/3} and you see 2 in the first envelope.
Seeing 2 is only one of the many possible cases. You haven’t calculated the total probability.