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.
Sourcepub fn anon_nbt(&mut self) -> AnonNbt
pub fn anon_nbt(&mut self) -> AnonNbt
A random unnamed network NBT root (any tag type, TAG_End 10% of the time).
Sourcepub fn anon_opt_nbt(&mut self) -> Option<AnonNbt>
pub fn anon_opt_nbt(&mut self) -> Option<AnonNbt>
Optional unnamed NBT (None 30% of the time).
Sourcepub fn fixed_bytes(&mut self, n: usize) -> Bytes
pub fn fixed_bytes(&mut self, n: usize) -> Bytes
Exactly n random bytes.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Gen
impl Freeze for Gen
impl Move 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