PROBABILITY_TO_EVENT

All functions > BUSINESS_SIMULATIONS > PROBABILITY_TO_EVENT

Returns the discrete event (true or false) with the given probability based on the given hashing key.

Syntax

PROBABILITY_TO_EVENT(hashing_key: VARCHAR, probability: DOUBLE) → BOOLEAN
sql

Arguments

ParameterTypeRequiredDescription
hashing_keyVARCHARYesString value to hash (typically user ID or session ID)
probabilityDOUBLEYesProbability of TRUE result (between 0.0 and 1.0)

Returns

BOOLEAN - Deterministic TRUE/FALSE based on probability threshold

Notes

  • Deterministic - same key always produces same result
  • Returns TRUE with given probability, FALSE otherwise
  • Uses HASH01 internally compared against probability threshold
  • Probability should be between 0.0 (never) and 1.0 (always)
  • Useful for A/B testing, feature flags, random sampling
  • Common for conversion simulations, user assignments
Last update at: 2025/10/13 10:23:46