pub struct JavaRandom { /* private fields */ }Expand description
java.util.Random, bit-exact: the 48-bit linear congruential generator of
Knuth, TAOCP vol. 2 §3.2.1, as Java specifies it.
TLC draws all of its pseudo-random choices from instances of this class (or of its
subclass tlc2.util.RandomGenerator, which only adds counting and
RandomSource::next_prime).
Implementations§
Source§impl JavaRandom
impl JavaRandom
Trait Implementations§
Source§impl Clone for JavaRandom
impl Clone for JavaRandom
impl Copy for JavaRandom
Source§impl Debug for JavaRandom
impl Debug for JavaRandom
impl Eq for JavaRandom
Source§impl Hash for JavaRandom
impl Hash for JavaRandom
Source§impl PartialEq for JavaRandom
impl PartialEq for JavaRandom
Source§impl RandomSource for JavaRandom
impl RandomSource for JavaRandom
Source§fn next_bits(&mut self, bits: u32) -> i32
fn next_bits(&mut self, bits: u32) -> i32
The next
bits random bits (1..=32), as java.util.Random.next(bits):
non-negative for bits < 32, any i32 for 32.Source§fn next_double(&mut self) -> f64
fn next_double(&mut self) -> f64
Random.nextDouble(): a double in [0, 1) from 53 bits.Source§fn next_int_bounded(&mut self, bound: i32) -> Option<i32>
fn next_int_bounded(&mut self, bound: i32) -> Option<i32>
Random.nextInt(bound), or None when bound <= 0 (where Java throws
IllegalArgumentException). Draws nothing for a bad bound.Source§fn next_prime(&mut self) -> i32
fn next_prime(&mut self) -> i32
RandomGenerator.nextPrime(Random): one of TLC’s 1341 primes near 1.28
million, chosen with one nextDouble.Source§fn next_index(&mut self, size: u64) -> u64
fn next_index(&mut self, size: u64) -> u64
(int) Math.floor(nextDouble() * size): TLC’s index into a set of size
elements (SetEnumValue.randomElement, IntervalValue.randomElement,
SimulationWorker.randomState). size 0 gives 0, as in TLC, after drawing.impl StructuralPartialEq for JavaRandom
Auto Trait Implementations§
impl Forget for JavaRandom
impl Freeze for JavaRandom
impl Move for JavaRandom
impl RefUnwindSafe for JavaRandom
impl Send for JavaRandom
impl Sync for JavaRandom
impl Unpin for JavaRandom
impl UnsafeUnpin for JavaRandom
impl UnwindSafe for JavaRandom
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more