[][src]Struct qt_core::QRandomGenerator64

#[repr(C)]pub struct QRandomGenerator64 { /* fields omitted */ }

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

C++ class: QRandomGenerator64.

C++ documentation:

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

QRandomGenerator64 is a simple adaptor class around QRandomGenerator, making the QRandomGenerator::generate64() function the default for operator()(), instead of the function that returns 32-bit quantities. This class is intended to be used in conjunction with Standard Library algorithms that need 64-bit quantities instead of 32-bit ones.

In all other aspects, the class is the same. Please refer to QRandomGenerator's documentation for more information.

Methods

impl QRandomGenerator64[src]

pub unsafe fn call(&self) -> c_ulonglong[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates a 64-bit random quantity and returns it.

Calls C++ function: unsigned long long QRandomGenerator64::operator()().

C++ documentation:

Generates a 64-bit random quantity and returns it.

See also QRandomGenerator::generate() and QRandomGenerator::generate64().

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QRandomGenerator64>>
) -> Ref<QRandomGenerator64>
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

Calls C++ function: QRandomGenerator64& QRandomGenerator64::operator=(const QRandomGenerator64& other).

C++ documentation:

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

QRandomGenerator64 is a simple adaptor class around QRandomGenerator, making the QRandomGenerator::generate64() function the default for operator()(), instead of the function that returns 32-bit quantities. This class is intended to be used in conjunction with Standard Library algorithms that need 64-bit quantities instead of 32-bit ones.

In all other aspects, the class is the same. Please refer to QRandomGenerator's documentation for more information.

pub unsafe fn discard(&self, z: c_ulonglong)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: void QRandomGenerator64::discard(unsigned long long z).

pub unsafe fn generate(&self) -> u64[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates one 64-bit random value and returns it.

Calls C++ function: quint64 QRandomGenerator64::generate().

C++ documentation:

Generates one 64-bit random value and returns it.

Note about casting to a signed integer: all bits returned by this function are random, so there's a 50% chance that the most significant bit will be set. If you wish to cast the returned value to qint64 and keep it positive, you should mask the sign bit off:

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

See also QRandomGenerator and QRandomGenerator::generate64().

pub unsafe fn global() -> Ptr<QRandomGenerator64>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: static QRandomGenerator64* QRandomGenerator64::global().

pub unsafe fn max() -> c_ulonglong[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: static unsigned long long QRandomGenerator64::max().

pub unsafe fn min() -> c_ulonglong[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: static unsigned long long QRandomGenerator64::min().

pub unsafe fn from_u32(seed_value: u32) -> CppBox<QRandomGenerator64>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: [constructor] void QRandomGenerator64::QRandomGenerator64(quint32 seedValue = …).

pub unsafe fn from_u32_longlong(
    seed_buffer: *const u32,
    len: c_longlong
) -> CppBox<QRandomGenerator64>
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: [constructor] void QRandomGenerator64::QRandomGenerator64(const quint32* seedBuffer, long long len).

pub unsafe fn from_2_u32(
    begin: *const u32,
    end: *const u32
) -> CppBox<QRandomGenerator64>
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: [constructor] void QRandomGenerator64::QRandomGenerator64(const quint32* begin, const quint32* end).

pub unsafe fn from_q_random_generator(
    other: impl CastInto<Ref<QRandomGenerator>>
) -> CppBox<QRandomGenerator64>
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: [constructor] void QRandomGenerator64::QRandomGenerator64(const QRandomGenerator& other).

pub unsafe fn new() -> CppBox<QRandomGenerator64>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

Calls C++ function: [constructor] void QRandomGenerator64::QRandomGenerator64().

C++ documentation:

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

QRandomGenerator64 is a simple adaptor class around QRandomGenerator, making the QRandomGenerator::generate64() function the default for operator()(), instead of the function that returns 32-bit quantities. This class is intended to be used in conjunction with Standard Library algorithms that need 64-bit quantities instead of 32-bit ones.

In all other aspects, the class is the same. Please refer to QRandomGenerator's documentation for more information.

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QRandomGenerator64>>
) -> CppBox<QRandomGenerator64>
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

Calls C++ function: [constructor] void QRandomGenerator64::QRandomGenerator64(const QRandomGenerator64& other).

C++ documentation:

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

QRandomGenerator64 is a simple adaptor class around QRandomGenerator, making the QRandomGenerator::generate64() function the default for operator()(), instead of the function that returns 32-bit quantities. This class is intended to be used in conjunction with Standard Library algorithms that need 64-bit quantities instead of 32-bit ones.

In all other aspects, the class is the same. Please refer to QRandomGenerator's documentation for more information.

pub unsafe fn securely_seeded() -> CppBox<QRandomGenerator64>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: static QRandomGenerator64 QRandomGenerator64::securelySeeded().

pub unsafe fn system() -> Ptr<QRandomGenerator64>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: static QRandomGenerator64* QRandomGenerator64::system().

Methods from Deref<Target = QRandomGenerator>

pub unsafe fn bounded_double(&self, highest: c_double) -> c_double[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates one random double in the range between 0 (inclusive) and highest (exclusive). This function is equivalent to and is implemented as:

Calls C++ function: double QRandomGenerator::bounded(double highest).

C++ documentation:

Generates one random double in the range between 0 (inclusive) and highest (exclusive). This function is equivalent to and is implemented as:


  return generateDouble() * highest;

See also generateDouble() and bounded().

pub unsafe fn bounded_u32(&self, highest: u32) -> u32[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: quint32 QRandomGenerator::bounded(quint32 highest).

C++ documentation:

This is an overloaded function.

Generates one random 32-bit quantity in the range between 0 (inclusive) and highest (exclusive). The same result may also be obtained by using std::uniform_int_distribution with parameters 0 and highest - 1. That class can also be used to obtain quantities larger than 32 bits.

For example, to obtain a value between 0 and 255 (inclusive), one would write:

quint32 v = QRandomGenerator::bounded(256);

Naturally, the same could also be obtained by masking the result of generate() to only the lower 8 bits. Either solution is as efficient.

Note that this function cannot be used to obtain values in the full 32-bit range of quint32. Instead, use generate().

See also generate(), generate64(), and generateDouble().

pub unsafe fn bounded_int(&self, highest: c_int) -> c_int[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: int QRandomGenerator::bounded(int highest).

C++ documentation:

This is an overloaded function.

Generates one random 32-bit quantity in the range between 0 (inclusive) and highest (exclusive). highest must not be negative.

Note that this function cannot be used to obtain values in the full 32-bit range of int. Instead, use generate() and cast to int.

See also generate(), generate64(), and generateDouble().

pub unsafe fn bounded_2_u32(&self, lowest: u32, highest: u32) -> u32[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: quint32 QRandomGenerator::bounded(quint32 lowest, quint32 highest).

C++ documentation:

This is an overloaded function.

Generates one random 32-bit quantity in the range between lowest (inclusive) and highest (exclusive). The same result may also be obtained by using std::uniform_int_distribution with parameters lowest and \a highest - 1. That class can also be used to obtain quantities larger than 32 bits.

For example, to obtain a value between 1000 (incl.) and 2000 (excl.), one would write:

quint32 v = QRandomGenerator::bounded(1000, 2000);

Note that this function cannot be used to obtain values in the full 32-bit range of quint32. Instead, use generate().

See also generate(), generate64(), and generateDouble().

pub unsafe fn bounded_2_int(&self, lowest: c_int, highest: c_int) -> c_int[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: int QRandomGenerator::bounded(int lowest, int highest).

C++ documentation:

This is an overloaded function.

Generates one random 32-bit quantity in the range between lowest (inclusive) and highest (exclusive), both of which may be negative.

Note that this function cannot be used to obtain values in the full 32-bit range of int. Instead, use generate() and cast to int.

See also generate(), generate64(), and generateDouble().

pub unsafe fn call(&self) -> c_uint[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates a 32-bit random quantity and returns it.

Calls C++ function: unsigned int QRandomGenerator::operator()().

C++ documentation:

Generates a 32-bit random quantity and returns it.

See also generate() and generate64().

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QRandomGenerator>>
) -> Ref<QRandomGenerator>
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Copy-assignment operator.

Calls C++ function: QRandomGenerator& QRandomGenerator::operator=(const QRandomGenerator& other).

C++ documentation:

Copy-assignment operator.

pub unsafe fn discard(&self, z: c_ulonglong)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Discards the next z entries from the sequence. This method is equivalent to calling generate() z times and discarding the result, as in:

Calls C++ function: void QRandomGenerator::discard(unsigned long long z).

C++ documentation:

Discards the next z entries from the sequence. This method is equivalent to calling generate() z times and discarding the result, as in:


  while (z--)
      generator.generate();

pub unsafe fn generate_0a(&self) -> u32[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates a 32-bit random quantity and returns it.

Calls C++ function: quint32 QRandomGenerator::generate().

C++ documentation:

Generates a 32-bit random quantity and returns it.

See also operator()() and generate64().

pub unsafe fn generate_2a(&self, begin: *mut u32, end: *mut u32)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: void QRandomGenerator::generate(quint32* begin, quint32* end).

pub unsafe fn generate64(&self) -> u64[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates a 64-bit random quantity and returns it.

Calls C++ function: quint64 QRandomGenerator::generate64().

C++ documentation:

Generates a 64-bit random quantity and returns it.

See also operator()() and generate().

pub unsafe fn generate_double(&self) -> c_double[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Generates one random qreal in the canonical range [0, 1) (that is, inclusive of zero and exclusive of 1).

Calls C++ function: double QRandomGenerator::generateDouble().

C++ documentation:

Generates one random qreal in the canonical range [0, 1) (that is, inclusive of zero and exclusive of 1).

This function is equivalent to:

QRandomGenerator64 rd; return std::generate_canonical<qreal, std::numeric_limits<qreal>::digits>(rd);

The same may also be obtained by using std::uniform_real_distribution with parameters 0 and 1.

See also generate(), generate64(), and bounded().

pub unsafe fn seed_1a(&self, s: u32)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Reseeds this object using the value seed as the seed.

Calls C++ function: void QRandomGenerator::seed(quint32 s = …).

C++ documentation:

Reseeds this object using the value seed as the seed.

pub unsafe fn seed_0a(&self)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Reseeds this object using the value seed as the seed.

Calls C++ function: void QRandomGenerator::seed().

C++ documentation:

Reseeds this object using the value seed as the seed.

Trait Implementations

impl CppDeletable for QRandomGenerator64[src]

unsafe fn delete(&self)[src]

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

Calls C++ function: [destructor] void QRandomGenerator64::~QRandomGenerator64().

C++ documentation:

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality, seed-less Random Number Generator.

QRandomGenerator64 is a simple adaptor class around QRandomGenerator, making the QRandomGenerator::generate64() function the default for operator()(), instead of the function that returns 32-bit quantities. This class is intended to be used in conjunction with Standard Library algorithms that need 64-bit quantities instead of 32-bit ones.

In all other aspects, the class is the same. Please refer to QRandomGenerator's documentation for more information.

impl Deref for QRandomGenerator64[src]

type Target = QRandomGenerator

The resulting type after dereferencing.

fn deref(&self) -> &QRandomGenerator[src]

Calls C++ function: QRandomGenerator* static_cast<QRandomGenerator*>(QRandomGenerator64* ptr).

impl StaticDowncast<QRandomGenerator64> for QRandomGenerator[src]

unsafe fn static_downcast(ptr: Ptr<QRandomGenerator>) -> Ptr<QRandomGenerator64>[src]

Calls C++ function: QRandomGenerator64* static_cast<QRandomGenerator64*>(QRandomGenerator* ptr).

impl StaticUpcast<QRandomGenerator> for QRandomGenerator64[src]

unsafe fn static_upcast(ptr: Ptr<QRandomGenerator64>) -> Ptr<QRandomGenerator>[src]

Calls C++ function: QRandomGenerator* static_cast<QRandomGenerator*>(QRandomGenerator64* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.