cpuHash01
A random but stable number, 0..1, from a seed, computed in JavaScript.
cpuHash01(x: number): number
Import signal from shaders/std and use signal.cpuHash01.
Use it when a per-seed constant is worked out once on the CPU rather than at every pixel, such as the size and drift of each light in a set.
Parameters
| Name | Type | Notes |
|---|---|---|
x | number |
Example
const radiusX = cpuHash01(seed) * 0.5 + 0.2
const radiusY = cpuHash01(seed + 37) * 0.25 + 0.1
See also
pointer— The pointer's position, for a simulation step that reacts to the cursor.