pub struct Gen {
pub node_compat: bool,
/* private fields */
}Expand description
Seeded pseudo-random generator (SplitMix64).
Fields§
§node_compat: boolRestrict values to what node-minecraft-protocol round-trips (its varlong is
really 32-bit, its NBT root reader cannot take a bare TAG_End).
Implementations§
Source§impl Gen
impl Gen
Sourcepub fn int_in(&mut self, lo: i64, hi: i64, hints: &[i64]) -> i64
pub fn int_in(&mut self, lo: i64, hi: i64, hints: &[i64]) -> i64
An integer in [lo, hi], preferring hints, small values and the bounds.
Sourcepub fn small_count(&mut self) -> u8
pub fn small_count(&mut self) -> u8
A count for a field that sizes an array (0..=3).
Sourcepub fn varlong(&mut self) -> i64
pub fn varlong(&mut self) -> i64
A random VarLong value (non-negative 32-bit in node-compat mode: node’s varlong is really an unsigned 32-bit VarInt).
Sourcepub fn string(&mut self) -> ByteString
pub fn string(&mut self) -> ByteString
A random string.
Sourcepub fn string_in(&mut self, hints: &[&str]) -> ByteString
pub fn string_in(&mut self, hints: &[&str]) -> ByteString
One of hints (usually) or a random string.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Gen
impl Freeze for Gen
impl RefUnwindSafe for Gen
impl Send for Gen
impl Sync for Gen
impl Unpin for Gen
impl UnsafeUnpin for Gen
impl UnwindSafe for Gen
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