diff --git a/src/wallet.cpp b/src/wallet.cpp index 557784e5..b8ef2a20 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1190,7 +1190,7 @@ bool CWallet::CreateTransaction(const vector >& vecSend, CW scriptChange.SetDestination(vchPubKey.GetID()); // Insert change txn at random position: - vector::iterator position = wtxNew.vout.begin()+GetRandInt(wtxNew.vout.size()); + vector::iterator position = wtxNew.vout.begin()+GetRandInt(wtxNew.vout.size()+1); wtxNew.vout.insert(position, CTxOut(nChange, scriptChange)); } else