#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.
| provider | the name of the provider library for the random number generation |
| QCA::Random::Random | ( | const Random & | from | ) |
| uchar QCA::Random::nextByte | ( | ) |
Provide a random byte.
This method isn't normally required - you should use the static randomChar() method instead.
| SecureArray QCA::Random::nextBytes | ( | int | size | ) |
Provide a specified number of random bytes.
This method isn't normally required - you should use the static randomArray() method instead.
| size | the number of bytes to provide |
| static uchar QCA::Random::randomChar | ( | ) | [static] |
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
| static int QCA::Random::randomInt | ( | ) | [static] |
Provide a random integer.
This is the normal way of obtaining a single random integer, as shown below:
myRandomInt = QCA::Random::randomInt();
| static SecureArray QCA::Random::randomArray | ( | int | size | ) | [static] |
Provide a specified number of random bytes.
// build a 30 byte secure array. SecureArray arry = QCA::Random::randomArray(30);
| size | the number of bytes to provide |
1.5.2