WorkerScript and Math.random().



  • I'm running a JavaScript code by using the WorkerScript element. In the script I use the Math.random() -function, but it doesn't work right. Math.random() should use the time as a seed, but when it's used via WorkerScript the seed and the sequence of the random numbers is always the same on different runs. Has anybody else run into this problem? Is this a bug or am I using it wrong?



  • Hi,

    What version of Qt are you using? There was a general (not WorkerScript-specific) problem with random number generation prior to 4.7.2 (see http://bugreports.qt.nokia.com/browse/QTBUG-13440 for details).

    If you are using 4.7.2 or later and having this problem, I'd recommend filing a bug report for it.

    Regards,
    Michael


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.