X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.cpp;h=c02b6bb9783d0d44aa87b2637ab27f1c58b01823;hb=8505dbffa6e9007b04626eed609cc419423ed202;hp=91407109a037b2d545d3552bce7c8b7b5f18e6a2;hpb=4ca0237ec0d2825004fa3aa2b00a94da2a083b8b;p=novacoin.git diff --git a/src/wallet.cpp b/src/wallet.cpp index 9140710..c02b6bb 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -13,7 +13,7 @@ #include "coincontrol.h" #include #include - +#include #include "main.h" using namespace std; @@ -1829,7 +1829,9 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, unsigned int nSpendTime, vector > > vValue; int64_t nTotalLower = 0; - random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt); + std::random_device rd; + std::mt19937 g(rd()); + shuffle(vCoins.begin(), vCoins.end(), g); BOOST_FOREACH(const COutput &output, vCoins) { @@ -1888,7 +1890,8 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, unsigned int nSpendTime, } // Solve subset sum by stochastic approximation - sort(vValue.rbegin(), vValue.rend(), CompareValueOnly()); + std::sort(vValue.begin(), vValue.end(), CompareValueOnly()); + std::reverse(vValue.begin(), vValue.end()); vector vfBest; int64_t nBest;