Struct noise::PermutationTable [] [src]

pub struct PermutationTable {
    // 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 per generator.

Methods

impl PermutationTable
[src]

fn new(seed: u32) -> PermutationTable

Deterministically generates a new permutation table based on a u32 seed 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::PermutationTable;

let perm_table = PermutationTable::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 Copy for PermutationTable
[src]

impl Rand for PermutationTable
[src]

fn rand<R: Rng>(rng: &mut R) -> PermutationTable

Generates a PermutationTable using a random seed.

Examples

extern crate noise;
extern crate rand;

use noise::PermutationTable;

let perm_table = rand::random::<PermutationTable>();
extern crate noise;
extern crate rand;

use noise::PermutationTable;
use rand::{SeedableRng, Rng, XorShiftRng};

let mut rng: XorShiftRng = SeedableRng::from_seed([1, 2, 3, 4]);
let perm_table = rng.gen::<PermutationTable>();

impl Clone for PermutationTable
[src]

fn clone(&self) -> PermutationTable

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for PermutationTable
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.