HASH01()
All functions > BUSINESS > HASH01()
Returns a value between 0 and 1 based on the given hashing key.
Signatures
Returns: Deterministic value in range [0.0, 1.0)
HASH01(hashing_key: VARCHAR) → DOUBLE sql
| Parameter | Type | Required | Description |
|---|---|---|---|
hashing_key | VARCHAR | Yes | String value to hash (typically user ID or session ID) |
Notes
- Deterministic hash - same key always produces same value
- Uses MD5 hashing internally
- Uniformly distributed across [0.0, 1.0) range
- Useful for A/B testing, sampling, and rollouts
- Each unique key maps to a stable value
- Foundation for other simulation functions (SAMPLE_UNIFORM, SAMPLE_BOOL)
Examples
FeatureQL
SELECT
f1 := HASH01('k') -- Stable fraction in [0, 1) for a fixed string key
;Result
| f1 VARCHAR |
|---|
| 0.5503645788728219 |
On this page