#include <QtCrypto>
Inheritance diagram for QCA::Random:
Public Member Functions | |
Random (const QString &provider=QString()) | |
Random (const Random &from) | |
Random & | operator= (const Random &from) |
uchar | nextByte () |
SecureArray | nextBytes (int size) |
Static Public Member Functions | |
static uchar | randomChar () |
static int | randomInt () |
static SecureArray | randomArray (int size) |
QCA provides a built in source of random numbers, which can be accessed through this class. You can also use an alternative random number source, by implementing another provider.
The normal use of this class is expected to be through the static members - randomChar(), randomInt() and randomArray().
|
Standard Constructor.
|
|
Copy constructor.
|
|
Assignment operator.
|
|
Provide a random byte. This method isn't normally required - you should use the static randomChar() method instead.
|
|
Provide a specified number of random bytes. This method isn't normally required - you should use the static randomArray() method instead.
|
|
Provide a random character (byte). This is the normal way of obtaining a single random char (ie. 8 bit byte), as shown below: myRandomChar = QCA::Random::randomChar(); If you need a number of bytes, perhaps randomArray() may be of use
|
|
Provide a random integer. This is the normal way of obtaining a single random integer, as shown below: myRandomInt = QCA::Random::randomInt();
|
|
Provide a specified number of random bytes.
// build a 30 byte secure array. SecureArray arry = QCA::Random::randomArray(30);
|