Parameters
| Name | Type | Description |
|---|---|---|
| p | f32 | Input value to hash. |
Returns
WGSL Code
fn hash1D(p: f32) -> f32 { // Convert to integer and apply bit manipulation let x = bitcast<u32>(p + 123.456789); var h = x; // Wang hash function h = (h ^ 61u) ^ (h >> 16u); h = h + (h << 3u); h = h ^ (h >> 4u); h = h * 0x27d4eb2du; h = h ^ (h >> 15u); // Convert back to float and normalize return f32(h) / 4294967296.0; }