use random() instead of rand()

This commit is contained in:
Arvid Norberg 2012-12-10 08:08:20 +00:00
parent 5a23ca5855
commit 27db5e3f49
2 changed files with 3 additions and 2 deletions

View File

@ -760,7 +760,7 @@ namespace libtorrent
// in anonymous mode, every peer connection
// has a unique peer-id
for (int i = 0; i < 20; ++i)
*ptr++ = rand();
*ptr++ = random();
}
else
{

View File

@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <libtorrent/io.hpp>
#include <libtorrent/random.hpp>
#include <libtorrent/invariant_check.hpp>
#include <libtorrent/kademlia/node_id.hpp> // for generate_random_id
#include <libtorrent/kademlia/rpc_manager.hpp>
@ -463,7 +464,7 @@ bool rpc_manager::invoke(entry& e, udp::endpoint target_addr
std::string transaction_id;
transaction_id.resize(2);
char* out = &transaction_id[0];
int tid = rand() ^ (rand() << 5);
int tid = random() ^ (random() << 5);
io::write_uint16(tid, out);
e["t"] = transaction_id;