Documentation - v7.12.0
    Preparing search index...

    Function performDraw

    • Performs a weighted random draw, typically used to decide whether an event should be sampled (e.g. included in a telemetry payload).

      Parameters

      • threshold: number

        The probability of success, as a percentage between 0 and 100.

      Returns boolean

      true if the draw succeeds, false otherwise. Always false when threshold is 0.

      const isSampled = performDraw(10)
      if (isSampled) {
      // Include the event in the sampled payload.
      }