Barnsley fern
Very simple fractal based on random numbers, that resembles the leaf of a fern.
if (random < 0.01) {
nx = 0;
ny = 0.16 * y;
}
else if (random < 0.86) {
nx = (0.85 * x) + (0.04 * y);
ny = (-0.04 * x) + (0.85 * y) + 1.6;
}
else if (random < 0.93) {
nx = (0.2 * x) - (0.26 * y);
ny = (0.23 * x) + (0.22 * y) + 1.6;
}
else {
nx = (-0.15 * x) + (0.28 * y);
ny = (0.26 * x) + (0.24 * y) + 0.44;
}
x = nx;
y = ny;