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
Parameter | Type | Required | Description |
---|---|---|---|
hashing_key | VARCHAR | Yes | String value to hash (typically user ID or session ID) |
lower | DOUBLE | Yes | Lower bound of uniform distribution (inclusive) |
upper | DOUBLE | Yes | Upper 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