@@ -120,7 +120,7 @@ where
120120 }
121121}
122122
123- impl < W : Word + Default , const N : usize , G : Generator < Output = [ W ; N ] > > BlockRng < G > {
123+ impl < W : Word , const N : usize , G : Generator < Output = [ W ; N ] > > BlockRng < G > {
124124 /// Create a new `BlockRng` from an existing RNG implementing
125125 /// `Generator`. Results will be generated on first use.
126126 #[ inline]
@@ -147,9 +147,7 @@ impl<W: Word + Default, const N: usize, G: Generator<Output = [W; N]>> BlockRng<
147147 None
148148 }
149149 }
150- }
151150
152- impl < W : Word , const N : usize , G : Generator < Output = [ W ; N ] > > BlockRng < G > {
153151 /// Get the index into the result buffer.
154152 ///
155153 /// If this is equal to or larger than the size of the result buffer then
@@ -166,6 +164,16 @@ impl<W: Word, const N: usize, G: Generator<Output = [W; N]>> BlockRng<G> {
166164 self . results [ 0 ] = W :: from_usize ( index) ;
167165 }
168166
167+ /// Clear the results buffer
168+ ///
169+ /// This overwrites all bits of the results buffer, and thus may be useful
170+ /// in conjunction with [`zeroize`](https://docs.rs/zeroize/).
171+ #[ inline]
172+ pub fn clear ( & mut self ) {
173+ self . results = [ W :: default ( ) ; N ] ;
174+ self . results [ 0 ] = W :: from_usize ( N ) ;
175+ }
176+
169177 /// Re-generate buffer contents, skipping the first `n` words
170178 ///
171179 /// Existing buffer contents are discarded. A new set of results is
0 commit comments