QRandomGenerator64 Class

QRandomGenerator64クラスは、高品質のシードレス乱数生成器から64ビットの乱数値を取得することができます。詳細...

ヘッダー #include <QRandomGenerator64>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
継承: QRandomGenerator

パブリックな型

パブリック関数

quint64 generate()
QRandomGenerator64::result_type operator()()

詳しい説明

QRandomGenerator64 はQRandomGenerator の周りの単純なアダプタクラスで、32ビット量を返す関数の代わりにoperator()() のためにQRandomGenerator::generate64() 関数をデフォルトにします。このクラスは、32ビット量の代わりに64ビット量を必要とする標準ライブラリ・アルゴリズムと共に使用されることを意図している。

その他の点では、このクラスは同じです。詳細はQRandomGenerator のドキュメントを参照してください。

QRandomGeneratorも参照のこと

メンバ型のドキュメント

QRandomGenerator64::result_type

operator() が返す型の typedef。つまり quint64。

operator()も参照のこと

メンバ関数のドキュメント

quint64 QRandomGenerator64::generate()

64ビットの乱数値を生成して返します。

符号付き整数へのキャストに関する注意:この関数が返すビットはすべてランダムなので、最上位ビットがセットされる確率は50%です。返される値をqint64にキャストして正の値に保ちたい場合は、符号ビットをマスクする必要があります:

    qint64 value = QRandomGenerator64::global()->generate() & std::numeric_limits<qint64>::max();

QRandomGenerator およびQRandomGenerator::generate64()も参照の こと。

QRandomGenerator64::result_type QRandomGenerator64::operator()()

64 ビットの乱数を生成し、それを返します。

QRandomGenerator::generate() およびQRandomGenerator::generate64()も参照

© 2025 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.