Function randomize_time

Source
pub(crate) fn randomize_time<R: Rng>(
    rng: &mut R,
    when: SystemTime,
    max: Duration,
) -> SystemTime
Expand description

Return a random time within the range when-max ..= when.

Uses a uniform distribution; saturates at UNIX_EPOCH. Rounds down to the nearest 10 seconds.

This kind of date randomization is used in our persistent state in an attempt to make some kinds of traffic analysis attacks a bit harder for an attacker who can read our state after the fact.