greweb.me / Plots / 392 "PI RNG"

Sourcecode
392/main.rs

This was implemented for genuary.art "Create your own pseudo-random number generator and visually check the results." of JAN.24. let me explain why:

Each line is drawn from the bottom to the top. Actually the line is splitted into many segments that are drawn one after the other following an angle. The angle is initially pointing up but on each iteration, it gets randomly offset by a random value. That's where the random number generator (RNG) happens: a value of 0.0 means (go left) a value of 0.5 keep moving forward and a value of 1.0 (go right).

The funny part about the RNG at stake here is that it's implemented like this:

let mut rng_v = i / count; // value from 0 to 1, unique for each line
let mut custom_rng = || {
    rng_v = rng_v + PI;
    rng_v % 1.0
};

this basically is just translating a value by PI and keeping the fractional part 😅

this is actually almost like a sawtooth signal with a small offset. sawtooth that creates the oscillation effect on the line and the small offset makes a lower frequency waving effect of the lines.

What i'm trying to prove here is that despite the very not random RNG, I still managed to get a result that appears to be random.

was live coded and live plotted on https://twitch.tv/greweb

generative artist. doodling with algorithms (creative coding). shaders & fountain pens robot plotting.