Performs a weighted random draw, typically used to decide whether an event should be sampled (e.g. included in a telemetry payload).
The probability of success, as a percentage between 0 and 100.
0
100
true if the draw succeeds, false otherwise. Always false when threshold is 0.
true
false
threshold
const isSampled = performDraw(10)if (isSampled) { // Include the event in the sampled payload.} Copy
const isSampled = performDraw(10)if (isSampled) { // Include the event in the sampled payload.}
Performs a weighted random draw, typically used to decide whether an event should be sampled (e.g. included in a telemetry payload).