QCA::Random Class Reference
[QCA user API]

Source of random numbers. More...

#include <QtCrypto>

Collaboration diagram for QCA::Random:
Collaboration graph
[legend]

List of all members.

Public Member Functions

uchar nextByte ()
SecureArray nextBytes (int size)
Randomoperator= (const Random &from)
 Random (const Random &from)
 Random (const QString &provider=QString())

Static Public Member Functions

static SecureArray randomArray (int size)
static uchar randomChar ()
static int randomInt ()

Detailed Description

Source of random numbers.

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().

Examples:

randomtest.cpp.


Constructor & Destructor Documentation

QCA::Random::Random ( const QString provider = QString()  ) 

Standard Constructor.

Parameters:
provider the name of the provider library for the random number generation
QCA::Random::Random ( const Random from  ) 

Copy constructor.

Parameters:
from the Random object to copy from

Member Function Documentation

Random& QCA::Random::operator= ( const Random from  ) 

Assignment operator.

Parameters:
from the Random object to copy state from
uchar QCA::Random::nextByte (  ) 

Provide a random byte.

This method isn't normally required - you should use the static randomChar() method instead.

See also:
randomChar
Examples:
randomtest.cpp.
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.

Parameters:
size the number of bytes to provide
See also:
randomArray
Examples:
randomtest.cpp.
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.

Examples:
randomtest.cpp.
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();
Examples:
randomtest.cpp.
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);
Parameters:
size the number of bytes to provide
Examples:
randomtest.cpp.

The documentation for this class was generated from the following file:
Generated on Sat Nov 27 13:41:18 2010 for Qt Cryptographic Architecture by  doxygen 1.6.3