Skip to content

Commit

Permalink
🎨 Format spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Apr 28, 2023
1 parent 4be7f33 commit e48f4e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ pub mod chacha;
pub trait Rng<const OUTPUT: usize>: Clone {
/// Generates a random sequence of bytes, seeding from the internal state.
fn rand(&mut self) -> [u8; OUTPUT];

/// Generates a random of the specified type, seeding from the internal state.
fn generate<Generated>(&mut self) -> Generated
where
Generated: RandomGen<Self, OUTPUT>,
{
Generated::random(self)
}

/// Fill an array of bytes with randomness.
fn fill_bytes<Bytes>(&mut self, mut buffer: Bytes)
where
Expand All @@ -49,6 +51,7 @@ pub trait Rng<const OUTPUT: usize>: Clone {
length -= generated;
}
}

/// Fill an array with the specified type.
fn fill<Contents, Array>(&mut self, mut target: Array)
where
Expand All @@ -58,6 +61,7 @@ pub trait Rng<const OUTPUT: usize>: Clone {
let target = target.as_mut();
target.iter_mut().for_each(|entry| *entry = self.generate());
}

/// Generates a random of the specified type, seeding from the internal state.
fn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Number
where
Expand All @@ -66,6 +70,7 @@ pub trait Rng<const OUTPUT: usize>: Clone {
{
Number::random_range(self, range)
}

/// Shuffle a slice, using the RNG.
fn shuffle<Contents, Array>(&mut self, mut target: Array)
where
Expand Down

0 comments on commit e48f4e3

Please sign in to comment.