diff --git a/README.md b/README.md index efe8b8b..14998c7 100644 --- a/README.md +++ b/README.md @@ -404,12 +404,11 @@ of the reads. ##### `-s`, `--seed` -This option allows you to specify the [random seed][seed] used by the random subsampler. -By explicitly setting this parameter, you make the subsample for the input reproducible. -The seed is an integer, and by default it is not set, meaning the operating system will -seed the random subsampler. You should only pass this parameter if you are likely to -want to subsample the same input file again in the future and want the same subset of -reads. +This option allows you to specify the [random seed][seed] used by the random subsampler. By explicitly setting this +parameter, you make the subsample for the input reproducible. You only need to pass this parameter if you are likely +to want to subsample the same input file again in the future and want the same subset of reads. However, if you forget +to use this option, the seed generated by the system will be printed to the log output, allowing you to use it in the +future. #### Verbosity diff --git a/src/alignment.rs b/src/alignment.rs index 5268498..d0ea8b3 100644 --- a/src/alignment.rs +++ b/src/alignment.rs @@ -55,7 +55,11 @@ impl Runner for Alignment { let mut rng = match self.seed { Some(s) => rand_pcg::Pcg64::seed_from_u64(s), - None => rand_pcg::Pcg64::seed_from_u64(random()), + None => { + let seed = random(); + info!("Using seed: {}", seed); + rand_pcg::Pcg64::seed_from_u64(seed) + } }; let mut reader = diff --git a/src/subsampler.rs b/src/subsampler.rs index ecacfc7..20a8409 100644 --- a/src/subsampler.rs +++ b/src/subsampler.rs @@ -1,3 +1,4 @@ +use log::info; use rand::prelude::*; /// A `Struct` for dealing with the randomised part of sub-sampling. @@ -39,9 +40,14 @@ impl SubSampler { /// ``` fn shuffled_indices(&self, v: &[T]) -> Vec { let mut indices: Vec = (0..v.len() as u32).collect(); + let mut rng = match self.seed { Some(s) => rand_pcg::Pcg64::seed_from_u64(s), - None => rand_pcg::Pcg64::seed_from_u64(random()), + None => { + let seed = random(); + info!("Using seed: {}", seed); + rand_pcg::Pcg64::seed_from_u64(seed) + } }; indices.shuffle(&mut rng);