My second attempt. This time, I’m generating complex-valued math expressions, and use them to generate independent R,G,B channels, before merging the channels together.

I get more diversity, and with a minimal piece of code. This is fun!

Here is the code:

```
# $1 : probability of a termination node in [0,1]
# $2 : level of recursion (avoid stack overflow due to recursivity)
expr :
r,nl={[u,$2+1]}
if (u<$1" && "$2>1)" || "$2>10 # Termination node
if $r<0.85 u [X,Y]
elif $r<0.90 u [c,0]
elif $r<0.95 u [0,c]
else u [{_round(u([-15,-15],[15,15]),0.1)}]
fi
else # Binary operator
p1,p2={u([1,1],[2,2])*$1}
d={1/25}
if $r<$d u ccos(${-expr\ $p1,$nl})
elif $r<2*$d u csin(${-expr\ $p1,$nl})
elif $r<3*$d u ctanh(${-expr\ $p1,$nl})
elif $r<4*$d u ccosh(${-expr\ $p1,$nl})
elif $r<5*$d u csinh(${-expr\ $p1,$nl})
elif $r<6*$d u ctan(${-expr\ $p1,$nl})
elif $r<7*$d u cexp(${-expr\ $p1,$nl})
elif $r<8*$d u clog(${-expr\ $p1,$nl})
elif $r<9*$d u [cabs(${-expr\ $p1,$nl}),0]
elif $r<10*$d u [0,cabs(${-expr\ $p1,$nl})]
elif $r<11*$d u [carg(${-expr\ $p1,$nl}),0]
elif $r<12*$d u [0,carg(${-expr\ $p1,$nl})]
elif $r<13*$d u cconj(${-expr\ $p1,$nl})
elif $r<14*$d u (${-expr\ $p1,$nl})+(${-expr\ $p2,$nl})
elif $r<15*$d u (${-expr\ $p1,$nl})-(${-expr\ $p2,$nl})
elif $r<16*$d u ${-expr\ $p1,$nl}**${-expr\ $p2,$nl}
elif $r<17*$d u ${-expr\ $p1,$nl}//${-expr\ $p2,$nl}
elif $r<18*$d u (${-expr\ $p1,$nl})^^0.5
elif $r<19*$d u (${-expr\ $p1,$nl})^^2
elif $r<20*$d u (${-expr\ $p1,$nl})^^3
elif $r<21*$d u ${-expr\ $p1,$nl}*${-expr\ $p2,$nl}
elif $r<22*$d u ${-expr\ $p1,$nl}/${-expr\ $p2,$nl}
elif $r<23*$d u (${-expr\ $p1,$nl})^0.5
elif $r<24*$d u (${-expr\ $p1,$nl})^2
else u (${-expr\ $p1,$nl})^3
fi
fi
test_expr :
repeat 36
e[] "- Generate image \#"$>
repeat 3
do
expr=${-expr\ 0.1,0}
256,256,1,2,"begin(fx = u(20); fy = u(20)); X = fx*(x/w-0.5) + 0.5/w; Y = fy*(y/h-0.5) + 0.5/h;"$expr
r={u} if $u<0.3 channels. 0 elif $u<0.6 channel. 1 else norm. fi
n. 0,255 equalize. 256
+gradient_norm. cond={sqrt(iv)>2} rm. # Check that image contains enough contours
if !$cond rm. fi
while !$cond
done
a[-3--1] c r2dx. 128 round.
done
frame 1,1,0 append_tiles ,
```

And here is one result of running command `test_expr`

: