Skip to main content

Randomize Datetime

Goal

Write randomize rule logic to

  • Takes the original values of the type datetime, and adds random noise
  • Specify the random noise by using the offset and flat-noise parameters (percentage-noise excluded)

Ano Structure and Example

        ...
randomize <column> <rule-name>
type datetime
format "%1$tF %1$tT"
convert String2DateTime
offset <offset>
flat-noise <flat-noise>
...
  • type: datetime
  • format: %1$tF %1$tT - datetime format
  • convert: String2DateTime - a built-in conversion function.
  • offset: A fixed (double) value, in seconds, that is added to the original value.
  • flat-noise: A fixed noise value, in seconds, that is multiplied with the random number r
    • large flat-noise - larger spread of generated values

Noise Formula

  1. A random number r is drawn (at runtime) from the Standard Normal (Gaussian) Distribution Function
  2. We use r, together with given noise parameters to add noise to the original value

Noise formula for datetime

original_value + offset + (flat-noise * r)