History

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

Stephen Birarda committed 12 years ago

Commit f8c479f1 parent affd4991 file · +5 −0Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+5−0
@@ -235,6 +235,11 @@ void ScriptEngine::init() { · 234 unmodified lines
235235 // let the VoxelPacketSender know how frequently we plan to call it
236236 _voxelsScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS);
237237 _particlesScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS);
238+
239+ // call srand to seed the random number generator
240+ srand(QDateTime::currentMSecsSinceEpoch()
241+ + QCoreApplication::applicationPid()
242+ + NodeList::getInstance()->getNodeSocket().localPort());
238243
239244 }
240245

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t