Contents

RandomGenerator Class Reference

The RandomGenerator class is a tool for creating hard random numbers. More...

    #include <RandomGenerator>

Static Public Members

QByteArray getPositiveBytes ( int size )

Detailed Description

The RandomGenerator class is a tool for creating hard random numbers.

The RandomGenerator class provides a source of secure random numbers using the gnutls rnd API. The numbers are suitable for uses such as certificate serial numbers.

Member Function Documentation

QByteArray RandomGenerator::getPositiveBytes ( int size ) [static]

Generates a set of random bytes of the specified size. In order to allow these to be conveniently used as serial numbers, this method ensures that the value returned is positive (ie. that the first bit is 0). This means that you get one less bit of entropy than requested, but avoids interoperability issues.

Note that this method will either return the number of bytes requested, or a null QByteArray. It will never return a smaller number.