filter:   math ×
Sunday, March 8th, 2026 math random techniques • 172w

Lets use sine as a randomness provider to generate a infinite sequence of random numbers that change smoothly with no state:

1. Step wave that grows from 0-1 and resets back to 0 again every 1:

step(x) = ((x % 1) + 1) % 1

2-3. The random number generator from the last post:

random(x) = sin(floor(x) ** 3)

4. Interpolate between the current random number and the next:

noise(x) = step(x) * random(x + 1) + (1 - step(x)) * random(x)

5. Combine multiple sequences of different frequencies and amplitudes:

noise(x) + noise(x * 2) / 2 + noise(x * 4) / 4 + noise(x * 8 ) / 8

Graph of each:



done_

Sunday, March 8th, 2026 math random techniques • 174w

Lets use sine as a randomness provider to generate a infinite sequence of random numbers with no state:

1. Sine wave: 

sin(x)

2. Sample the wave by an non linear expression in order to avoid the linear repeat pattern of the sine: 

sin(x ** 3)

3. Extract only the values at integer points that represent the indexes of the random numbers in the sequence: 

sin(floor(x) ** 3)

4. Map the optional seed to the 0-1 range and added multiplied by 2PI in the sample location: 

sin((floor(x) + seed * 2 * Math.PI) ** 3)

Graph of each:



done_