[][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(&mut self) -> c_ulonglong[src]

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

pub unsafe fn from_2_u32(
    begin: impl CastInto<Ptr<u32>>,
    end: impl CastInto<Ptr<u32>>
) -> CppBox<QRandomGenerator64>
[src]

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

Methods from Deref<Target = QRandomGenerator>

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

Copy-assignment operator.

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

C++ documentation:

Copy-assignment operator.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

pub unsafe fn generate_2a(
    &mut self,
    begin: impl CastInto<MutPtr<u32>>,
    end: impl CastInto<MutPtr<u32>>
)
[src]

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

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

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.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

pub unsafe fn seed_0a(&mut self)[src]

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.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

Trait Implementations

impl CppDeletable for QRandomGenerator64[src]

unsafe fn delete(&mut 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 DerefMut for QRandomGenerator64[src]

fn deref_mut(&mut self) -> &mut 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).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QRandomGenerator>
) -> MutPtr<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).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QRandomGenerator64>
) -> MutPtr<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.