How to fix CoinBase pay too much error ERROR: ConnectBlock() : coinbase pays too much (actual=20000000 vs limit=20000000)

I got this error at my debug.log

anyone know how to fix this issue? I am coding a new coin, changing its rewards, which parametter I need change to increase the limit.

on the line:

 if (vtx[0].GetValueOut() &gt; GetBlockValue(pindex-&gt;nHeight, nFees, pindex-&gt;nBits))
        return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetV$


I changed my nsubsidy for the code

int getrandint(int min, int max)
{
    int num;
    num=rand();
    num=num%(max-min+1)+min;
    return num;
}



int64 static GetBlockValue(int nHeight, int64 nFees, unsigned int nBits)
{
    if (nHeight == 0)
    {
        return nGenesisBlockRewardCoin;
    }

   unsigned int i, iMax, iMin;


   iMin = 1;
   iMax = 50;

if(nHeight&lt;500)
{
iMax = 3;
}
if(nHeight &gt; 8000)
{
iMax = 30;
}
if(nHeight &gt; 20000)
{
iMax = 20;
}
if(nHeight &gt; 100000)
{
iMax = 10;
}


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



    // Subsidy is cut in half every 60480 blocks (21 days)
    //nSubsidy &gt;&gt;= (nHeight / 60480);

    // Minimum subsidy
    if (nSubsidy &lt; nBlockRewardMinimumCoin)
    {
        nSubsidy = nBlockRewardMinimumCoin;
    }

    return nSubsidy + nFees;

}


The code originally was 

int64 static GetBlockValue(int nHeight, int64 nFees, unsigned int nBits)
{
    if (nHeight == 0)
    {
        return nGenesisBlockRewardCoin;
    }

    int64 nSubsidy = nBlockRewardStartCoin;

    // Subsidy is cut in half every 60480 blocks (21 days)
    nSubsidy &gt;&gt;= (nHeight / 60480);

    // Minimum subsidy
    if (nSubsidy &lt; nBlockRewardMinimumCoin)
    {
        nSubsidy = nBlockRewardMinimumCoin;
    }

    return nSubsidy + nFees;
}


Because of what I change, my code give the error coinbase pays too much

root@eatSushi1:~/dogequark/src$ ./dogequarkd
dogequark server starting
root@eatSushi1:~/dogequark/src$ terminate called after throwing an instance of 'std::runtime_error'
  what():  CreateNewBlock() : ConnectBlock failed


I also got this error when I run the coind at another server after cloning through github.
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.