Quote Originally Posted by Segev View Post
In fact, if anything, this would be a strong reason to have a law which, even if this is normally not permitted, gave the Emperor a legal right (and perhaps responsibility) to have a harem of wives and concubines, the children of which are all considered legitimate. Even if nobody else is permitted this, it makes sense due to the national security concerns surrounding the imperial bloodline. If the Emperor (or Empress) happens to ALSO fill it with members of his (or her) own sex for his...personal taste...that's his (or her) prerogative. Though that would open sticky questions of the parentage of the harem-produced children, since the mixed-sex harem could be *ahem* entertaining itself. At least with a male Emperor. A female Empress obviously is going to know which kids are hers.
The Emperor (or Empress) could always have the male part of their harem at one end of the palace and the female part at the other end, plus some guards of the same gender as their charges, to keep them separate.

Or possibly on separate islands, in different lakes.

Alternatively maybe the clerks are very, very good at keeping track, there's an extensive garden full of alchemical supplies, that, to quote Terry Pratchett, allow you to sow your wild oats whilst guaranting a crop failure, or perhaps they've invented physical contraception methods.

Or maybe the harem's carefully selected so that those members who're the same gender as the ruler aren't attracted in any way to the other gender - thus essentially rendering the point moot.