Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    WorkerScript and Math.random().

    QML and Qt Quick
    2
    2
    1853
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      makivioj last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • M
        mbrasser last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post