seed random number generator in ScriptEngine for Math.random use in JS

This commit is contained in:
Stephen Birarda 2014-03-25 14:28:26 -07:00
parent affd499188
commit f8c479f9c5

View file

@ -235,6 +235,11 @@ 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());
}