mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Merge pull request #2495 from birarda/random-number
remove loadRandomIdentifier and random number generator seed no longer required
This commit is contained in:
commit
46f8e2493b
4 changed files with 2 additions and 20 deletions
|
@ -235,12 +235,6 @@ void ScriptEngine::init() {
|
|||
// let the VoxelPacketSender know how frequently we plan to call it
|
||||
_voxelsScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS);
|
||||
_particlesScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS);
|
||||
|
||||
// call srand to seed the random number generator
|
||||
srand(QDateTime::currentMSecsSinceEpoch()
|
||||
+ QCoreApplication::applicationPid()
|
||||
+ NodeList::getInstance()->getNodeSocket().localPort());
|
||||
|
||||
}
|
||||
|
||||
void ScriptEngine::registerGlobalObject(const QString& name, QObject* object) {
|
||||
|
|
|
@ -413,9 +413,8 @@ void NodeList::sendSTUNRequest() {
|
|||
|
||||
// transaction ID (random 12-byte unsigned integer)
|
||||
const uint NUM_TRANSACTION_ID_BYTES = 12;
|
||||
unsigned char transactionID[NUM_TRANSACTION_ID_BYTES];
|
||||
loadRandomIdentifier(transactionID, NUM_TRANSACTION_ID_BYTES);
|
||||
memcpy(stunRequestPacket + packetIndex, &transactionID, sizeof(transactionID));
|
||||
QUuid randomUUID = QUuid::createUuid();
|
||||
memcpy(stunRequestPacket + packetIndex, randomUUID.toRfc4122().data(), NUM_TRANSACTION_ID_BYTES);
|
||||
|
||||
// lookup the IP for the STUN server
|
||||
static HifiSockAddr stunSockAddr(STUN_SERVER_HOSTNAME, STUN_SERVER_PORT);
|
||||
|
|
|
@ -206,15 +206,6 @@ bool isInEnvironment(const char* environment) {
|
|||
}
|
||||
}
|
||||
|
||||
void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes) {
|
||||
// seed the the random number generator
|
||||
srand(time(NULL));
|
||||
|
||||
for (int i = 0; i < numBytes; i++) {
|
||||
identifierBuffer[i] = rand() % 256;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function: getCmdOption()
|
||||
// Description: Handy little function to tell you if a command line flag and option was
|
||||
|
|
|
@ -96,8 +96,6 @@ int getNthBit(unsigned char byte, int ordinal); /// determines the bit placement
|
|||
|
||||
bool isInEnvironment(const char* environment);
|
||||
|
||||
void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes);
|
||||
|
||||
const char* getCmdOption(int argc, const char * argv[],const char* option);
|
||||
bool cmdOptionExists(int argc, const char * argv[],const char* option);
|
||||
|
||||
|
|
Loading…
Reference in a new issue