SAMPLE_UNIFORM

All functions > BUSINESS_SIMULATIONS > SAMPLE_UNIFORM

Returns a value uniformly chosen between two bounds based on the given hashing key.

Syntax

SAMPLE_UNIFORM(hashing_key: VARCHAR, lower: DOUBLE, upper: DOUBLE) → DOUBLE
sql

Arguments

ParameterTypeRequiredDescription
hashing_keyVARCHARYesString value to hash (typically user ID or session ID)
lowerDOUBLEYesLower bound of uniform distribution (inclusive)
upperDOUBLEYesUpper bound of uniform distribution (inclusive)

Returns

DOUBLE - Deterministic value uniformly distributed in [lower, upper]

Notes

  • Deterministic - same key always produces same value
  • Uses HASH01 internally scaled to [lower, upper] range
  • Uniformly distributed between bounds
  • Useful for A/B testing with continuous values
  • Each unique key maps to stable value in range
  • Common for price experiments, discount simulations
Last update at: 2025/10/13 10:23:46