Skip to content

Commit

Permalink
Use from_nanos in UniformDuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazzaz committed Aug 5, 2018
1 parent fbab1a1 commit baa7a50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/distributions/uniform.rs
Expand Up @@ -788,7 +788,7 @@ impl UniformSampler for UniformDuration {
}
UniformDurationMode::Medium { nanos } => {
let nanos = nanos.sample(rng);
Duration::new(nanos / 1_000_000_000, (nanos % 1_000_000_000) as u32)
Duration::from_nanos(nanos)
}
UniformDurationMode::Large { min_secs, min_nanos, max_secs, max_nanos, secs } => {
// constant folding means this is at least as fast as `gen_range`
Expand Down

0 comments on commit baa7a50

Please sign in to comment.