# [−][src]Trait rand::reseeding::Reseeder

    pub trait Reseeder<R> {
        fn reseed(&mut self, rng: &mut R);
    }

Something that can be used to reseed an RNG via `ReseedingRng`.

# Example

    use rand::{Rng, SeedableRng, StdRng};
    use rand::reseeding::{Reseeder, ReseedingRng};

    struct TickTockReseeder { tick: bool }
    impl Reseeder<StdRng> for TickTockReseeder {
        fn reseed(&mut self, rng: &mut StdRng) {
            let val = if self.tick {0} else {1};
            rng.reseed(&[val]);
            self.tick = !self.tick;
        }
    }
    fn main() {
        let rsdr = TickTockReseeder { tick: true };

        let inner = StdRng::new().unwrap();
        let mut rng = ReseedingRng::new(inner, 10, rsdr);

        // this will repeat, because it gets reseeded very regularly.
        let s: String = rng.gen_ascii_chars().take(100).collect();
        println!("{}", s);
    }

## Required methods

### `fn reseed(&mut self, rng: &mut R)`

Reseed the given RNG.

Loading content...

## Implementors

### `impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault`[src]

#### `fn reseed(&mut self, rng: &mut R)`[src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)