pub struct WorldgenRandom {
source: Xoroshiro,
next_gaussian: Option<f64>,
}Expand description
Vanilla’s WorldgenRandom when constructed for biome decoration.
Feature decoration always constructs WorldgenRandom(new XoroshiroRandomSource(...)).
Sampling then goes through BitRandomSource.next*, so it does not match raw
XoroshiroRandomSource for nextInt, bounded ints, doubles, longs, or gaussians.
Fields§
§source: Xoroshiro§next_gaussian: Option<f64>Implementations§
Source§impl WorldgenRandom
impl WorldgenRandom
Sourcepub const fn from_seed(seed: u64) -> Self
pub const fn from_seed(seed: u64) -> Self
Creates a new WorldgenRandom backed by vanilla’s XoroshiroRandomSource.
Sourcepub const fn set_seed(&mut self, seed: i64)
pub const fn set_seed(&mut self, seed: i64)
Re-seeds the backing XoroshiroRandomSource.
Vanilla WorldgenRandom inherits its gaussian cache from
LegacyRandomSource, but overrides setSeed to only reseed the
wrapped source. That means setDecorationSeed / setFeatureSeed
intentionally preserve a pending gaussian value.
Sourcepub fn set_decoration_seed(
&mut self,
seed: i64,
block_x: i32,
block_z: i32,
) -> i64
pub fn set_decoration_seed( &mut self, seed: i64, block_x: i32, block_z: i32, ) -> i64
Vanilla’s WorldgenRandom.setDecorationSeed.
Sourcepub const fn set_feature_seed(
&mut self,
decoration_seed: i64,
feature_index: i32,
step: i32,
)
pub const fn set_feature_seed( &mut self, decoration_seed: i64, feature_index: i32, step: i32, )
Vanilla’s WorldgenRandom.setFeatureSeed.
fn next_bits(&mut self, bits: u64) -> u64
Trait Implementations§
Source§impl MarsagliaPolarGaussian for WorldgenRandom
impl MarsagliaPolarGaussian for WorldgenRandom
Source§fn stored_next_gaussian(&self) -> Option<f64>
fn stored_next_gaussian(&self) -> Option<f64>
Gets the stored next gaussian.
Source§fn set_stored_next_gaussian(&mut self, value: Option<f64>)
fn set_stored_next_gaussian(&mut self, value: Option<f64>)
Sets the stored next gaussian.
Source§fn calculate_gaussian(&mut self) -> f64
fn calculate_gaussian(&mut self) -> f64
Calculates the next gaussian.
Source§impl Random for WorldgenRandom
impl Random for WorldgenRandom
fn fork(&mut self) -> Self
fn next_i32(&mut self) -> i32
fn next_i32_bounded(&mut self, bound: i32) -> i32
fn next_i64(&mut self) -> i64
fn next_f32(&mut self) -> f32
fn next_f64(&mut self) -> f64
fn next_bool(&mut self) -> bool
fn next_gaussian(&mut self) -> f64
fn next_positional(&mut self) -> RandomSplitter
fn next_i32_between(&mut self, min: i32, max: i32) -> i32
fn next_i32_between_exclusive(&mut self, min: i32, max: i32) -> i32
fn triangle(&mut self, min: f64, max: f64) -> f64
fn triangle_f32(&mut self, min: f32, max: f32) -> f32
fn consume_count(&mut self, count: i32)
Auto Trait Implementations§
impl Freeze for WorldgenRandom
impl RefUnwindSafe for WorldgenRandom
impl Send for WorldgenRandom
impl Sync for WorldgenRandom
impl Unpin for WorldgenRandom
impl UnsafeUnpin for WorldgenRandom
impl UnwindSafe for WorldgenRandom
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