Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-48753

QML Math.random() might return 1.0, javascript Math.random never should

    XMLWordPrintable

Details

    • dc5bf4275b6d40aefac038d57b3aea62a8be3d12

    Description

      If qrand() call in Math.random() returns RAND_MAX, result is 1.0. Code in qml/jsruntime/qv4mathobject.cpp:

      return Encode(qrand() / (double) RAND_MAX);
      

      In Javascript, max value is exclusive:
      http://www.w3schools.com/jsref/jsref_random.asp

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            erikv Erik Verbruggen
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes