Skip to main content

Randomize Decimal

Goal

Write randomize rule logic to

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

Ano Structure and Example

        ...
randomize <column> <rule-name>
type decimal
format %.2f
convert String2Decimal
offset <offset>
flat-noise <flat-noise>
percentage-noise <percentage-noise>
...
  • type: decimal
  • format: %.2f - decimal format
  • convert: String2Decimal - a built-in conversion function.
  • offset: A fixed value that is added to the original value.
  • flat-noise: A fixed noise value that is multiplied with the random number r
    • large flat-noise - larger spread of generated values
  • percentage-noise: A percentage (0.0% - 100.0%) of the original value that is multplied with the random number r
    • large percentage-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 decimal

original_value + offset + (flat-noise * r) + (original_value * percentage-noise/ 100) * r