#[repr(C)]
pub struct QRandomGenerator64 { /* private fields */ }
Expand description

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.

Implementations§

source§

impl QRandomGenerator64

source

pub unsafe fn call(&self) -> c_ulonglong

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

source

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

Available 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.

source

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

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

source

pub unsafe fn generate(&self) -> u64

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

source

pub unsafe fn global() -> Ptr<QRandomGenerator64>

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

source

pub unsafe fn max() -> c_ulonglong

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

source

pub unsafe fn min() -> c_ulonglong

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

source

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

Available 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 = …).

source

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

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

source

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

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

source

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

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

source

pub unsafe fn new() -> CppBox<QRandomGenerator64>

Available 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.

source

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

Available 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.

source

pub unsafe fn securely_seeded() -> CppBox<QRandomGenerator64>

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

source

pub unsafe fn system() -> Ptr<QRandomGenerator64>

Available 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>§

source

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

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

source

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

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

source

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

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

source

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

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

source

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

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

source

pub unsafe fn call(&self) -> c_uint

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

source

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

Available 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.

source

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

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

source

pub unsafe fn generate_0a(&self) -> u32

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

source

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

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

source

pub unsafe fn generate64(&self) -> u64

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

source

pub unsafe fn generate_double(&self) -> c_double

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

source

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

Available 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.

source

pub unsafe fn seed_0a(&self)

Available 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§

source§

impl CppDeletable for QRandomGenerator64

Available 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.
source§

unsafe fn delete(&self)

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.

source§

impl Deref for QRandomGenerator64

Available 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.
source§

fn deref(&self) -> &QRandomGenerator

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

§

type Target = QRandomGenerator

The resulting type after dereferencing.
source§

impl StaticDowncast<QRandomGenerator64> for QRandomGenerator

Available 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.
source§

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

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

source§

impl StaticUpcast<QRandomGenerator> for QRandomGenerator64

Available 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.
source§

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

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.