[][src]Struct world_map_gen::gen::RandomBoardGen

pub struct RandomBoardGen<R: Rng> { /* fields omitted */ }

Random world map board generator

Methods

impl RandomBoardGen<StdRng>[src]

pub fn from_seed(seed: u64) -> Self[src]

Create a new random map generator. It's internal random number generator is initialized by the given seed. Standard random number generator is used.

impl<R: Rng> RandomBoardGen<R>[src]

pub fn gen(
    &mut self,
    resolution: Option<Resolution>,
    width: Option<usize>,
    height: Option<usize>
) -> Result<Board<'static>>
[src]

Most generic method to generate a random map. When resolution is None, the resolution is determined from its size. When width and/or height are None they will be determined from the terminal size. In the case, when terminal size cannot be obtained, this method returns an error.

pub fn gen_auto(&mut self, width: usize, height: usize) -> Board<'static>[src]

Generate a random map of given width and height. Resolution is automatically determined from its size.

  • When width and height are lower than 15: low resolution
  • When width and height are lower than 120: middle resolution
  • Otherwise: high resolution

pub fn gen_small(&mut self, width: usize, height: usize) -> Board<'static>[src]

Generate a low resolution random map of given width and height.

pub fn gen_middle(&mut self, width: usize, height: usize) -> Board<'static>[src]

Generate a middle resolution random map of given width and height.

pub fn gen_large(&mut self, width: usize, height: usize) -> Board<'static>[src]

Generate a large resolution random map of given width and height.

Trait Implementations

impl Default for RandomBoardGen<ThreadRng>[src]

fn default() -> Self[src]

Create a new random map generator. It's internal random number generator is initialized by random number generated by hardware. Default thread-local random number generator is used.

Auto Trait Implementations

impl<R> Send for RandomBoardGen<R> where
    R: Send

impl<R> Sync for RandomBoardGen<R> where
    R: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]