QRandomGenerator64 Class
The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator. More...
Header: | #include <QRandomGenerator64> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Inherits: | QRandomGenerator |
Public Types
Public Functions
quint64 | generate() |
QRandomGenerator64::result_type | operator()() |
Detailed Description
QRandomGenerator64 is a simple adaptor class around QRandomGenerator, making the QRandomGenerator::generate64() function the default for operator()(), instead of the function that returns 32-bit quantities. This class is intended to be used in conjunction with Standard Library algorithms that need 64-bit quantities instead of 32-bit ones.
In all other aspects, the class is the same. Please refer to QRandomGenerator's documentation for more information.
See also QRandomGenerator.
Member Type Documentation
QRandomGenerator64::result_type
A typedef to the type that operator() returns. That is, quint64.
See also operator().
Member Function Documentation
quint64 QRandomGenerator64::generate()
Generates one 64-bit random value and returns it.
Note about casting to a signed integer: all bits returned by this function are random, so there's a 50% chance that the most significant bit will be set. If you wish to cast the returned value to qint64 and keep it positive, you should mask the sign bit off:
See also QRandomGenerator and QRandomGenerator::generate64().
QRandomGenerator64::result_type QRandomGenerator64::operator()()
Generates a 64-bit random quantity and returns it.
See also QRandomGenerator::generate() and QRandomGenerator::generate64().
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.