realXtend/naali — Issue #296: Remove or re-design the QtScript interop for the LCG class.
Author: juj
Created: 2011-12-08 09:29:22+00:00
State: open
Labels: QtScript

Due to how the QScriptValue type and the QtScript interop works, the random number generator object LCG that comes with MathGeoLib does not work properly when called from QtScript.

This is caused by QScriptValue creating value copies of the LCG object, and not storing back the state in C++ side.

At the moment, do not use the LCG object, or any math functions that take an LCG parameter as a input, from scripts. (From native C++ code it is perfectly ok). To generate a random number in the range [0,1], call the JavaScript built-in Math.random().