Struct StepRng
struct StepRng { ... }
A mock generator yielding very predictable output
This generates an arithmetic sequence (i.e. adds a constant each step)
over a u64 number, using wrapping arithmetic. If the increment is 0
the generator yields a constant.
Other integer types (64-bit and smaller) are produced via cast from u64.
Other types are produced via their implementation of Rng or
Distribution.
Output values may not be intuitive and may change in future releases but
are considered
portable.
(bool output is true when bit 1u64 << 31 is set.)
Example
use Rng;
use StepRng;
let mut my_rng = new;
let sample: = my_rng.random;
assert_eq!;
Implementations
impl StepRng
fn new(initial: u64, increment: u64) -> SelfCreate a
StepRng, yielding an arithmetic sequence starting withinitialand incremented byincrementeach time.
impl Clone for StepRng
fn clone(self: &Self) -> StepRng
impl Debug for StepRng
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Eq for StepRng
impl Freeze for StepRng
impl PartialEq for StepRng
fn eq(self: &Self, other: &StepRng) -> bool
impl RefUnwindSafe for StepRng
impl RngCore for StepRng
fn next_u32(self: &mut Self) -> u32fn next_u64(self: &mut Self) -> u64fn fill_bytes(self: &mut Self, dst: &mut [u8])
impl Send for StepRng
impl Serialize for StepRng
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error> where __S: _serde::Serializer
impl StructuralPartialEq for StepRng
impl Sync for StepRng
impl Unpin for StepRng
impl UnwindSafe for StepRng
impl<'de> Deserialize for StepRng
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error> where __D: _serde::Deserializer<'de>
impl<R> Rng for StepRng
impl<R> TryRngCore for StepRng
fn try_next_u32(self: &mut Self) -> Result<u32, <R as TryRngCore>::Error>fn try_next_u64(self: &mut Self) -> Result<u64, <R as TryRngCore>::Error>fn try_fill_bytes(self: &mut Self, dst: &mut [u8]) -> Result<(), <R as TryRngCore>::Error>
impl<T> Any for StepRng
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for StepRng
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for StepRng
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for StepRng
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> DeserializeOwned for StepRng
impl<T> From for StepRng
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for StepRng
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for StepRng
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for StepRng
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for StepRng
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip for StepRng
fn vzip(self: Self) -> V