Struct noise::Seed
[−]
[src]
pub struct Seed { // some fields omitted }
A seed table, required by all noise functions.
Table creation is expensive, so in most circumstances you'll only want to create one of these and reuse it everywhere.
Methods
impl Seed
[src]
fn new(seed: u32) -> Seed
Deterministically generates a new seed table based on a u32
value.
Internally this uses a XorShiftRng
, but we don't really need to worry
about cryptographic security when working with procedural noise.
Example
use noise::Seed; let seed = Seed::new(12);
fn get1<T: Signed + PrimInt + NumCast>(&self, x: T) -> usize
fn get2<T: Signed + PrimInt + NumCast>(&self, pos: Point2<T>) -> usize
fn get3<T: Signed + PrimInt + NumCast>(&self, pos: Point3<T>) -> usize
fn get4<T: Signed + PrimInt + NumCast>(&self, pos: Point4<T>) -> usize
Trait Implementations
impl Rand for Seed
[src]
fn rand<R: Rng>(rng: &mut R) -> Seed
Generates a random seed.
Examples
extern crate noise; extern crate rand; use noise::Seed; let seed = rand::random::<Seed>();
extern crate noise; extern crate rand; use noise::Seed; use rand::{SeedableRng, Rng, XorShiftRng}; let mut rng: XorShiftRng = SeedableRng::from_seed([1, 2, 3, 4]); let seed = rng.gen::<Seed>();