I try to estimate as closely as possible how much actual beer I'm going to end up with (I almost never get exactly 5 gal), and using that info, use my brewing software to figure out how much corn sugar I need. I boil it in water for 5-10 minutes and then add it to the bottling bucket before adding the beer, so that when I add the beer, the swirling of the beer mixes it. I have used that method for years and the only carbonation problem I've ever had was getting my sugar content right (and practice fixed that error), never in inconsistent carbonation.