How to fix CoinBase pay too much error
You should not be tampering with any code that has anything to do with determining block validity if you don't thoroughly understand the security model that proof of work coins use.

i = getrandint(iMin, iMax);
int64 nSubsidy = nBlockRewardStartCoin * i ;


You can't use any randomness in any code that involves block validation! The entire security model of the blockchain absolutely requires that servers agree on whether blocks are valid or not. Whatever it is you are trying to do, this is not how you do it.