Unicode isn't related to this at all (except that it, like other information, is stored in a binary format). I believe it's "out of range" simply because there are fewer than 65536 quotations in the list ;)
The trick is to get all of the 2-multiple bits set (~1 does this, as does [2^N]-2), then only allow those 2-mulitple bits in whatever random number was generated. It's clever.
The only reason I can think of using 65534 instead of ~1 would be that it might process a little faster, whereas ~1 is much easier to remember/type. But that will include the entire range up to the largest possible [2^N]-1 value, BUT only as bits which is [very] much faster than actually calculating any of that using traditional math. Intriguing.
Note that this only works for even [or odd] numbers though, because this is base 2. If it were base 3, it would work for numbers divisible by 3, etc. But computers are binary, so this is merely a shortcut for one very specific case: divisibility by 2.
