Skip to content

Commit

Permalink
tweak fill_random to support any rng element
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Jan 9, 2019
1 parent 08f908e commit 938c394
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(dead_code)]

use super::{galois_8, Error, SBSError};
use rand::{thread_rng, Rng};
use rand::{self, thread_rng, Rng};

type ReedSolomon = crate::ReedSolomon<galois_8::Field>;
type ShardByShard<'a> = crate::ShardByShard<'a, galois_8::Field>;
Expand Down Expand Up @@ -32,9 +32,11 @@ where
}
}

pub fn fill_random(arr: &mut [u8]) {
pub fn fill_random<T>(arr: &mut [T])
where rand::distributions::Standard: rand::distributions::Distribution<T>
{
for a in arr.iter_mut() {
*a = rand::random::<u8>();
*a = rand::random::<T>();
}
}

Expand Down

0 comments on commit 938c394

Please sign in to comment.