
cc=!random 0,0.8
c2=!random 0.25,$[4/($cc+2)^2]
f1=!rawmath x+$c2(x-$cc)^2
f2=!rawmath x-$c2(x+$cc)^2
tt=$[max(-2,$cc-1/$c2)]
oo=$[(sqrt(1+4*$c2*(2-$cc))-1)/(2*$c2)+$cc]

u=!random $tt+$ecart,$cc-$ecart
!if $oo-$cc>2*$ecart
 w=!random $cc+$ecart,$oo-$ecart
!else
 w=0.5*$cc+0.5*$oo
!endif

!if $tt>-1.9+$ecart
 v=!random -1.9,$tt-$ecart
 w=!randitem $w,$v,$v,$v
!endif
 
!if random(1)>0.5
 !distribute item minus,$[-($cc)],$[-($u)],$[-($w)],$f2 into out,cc,u,w,f
!else
 f=$f1
 out=plus
!endif

!if random(1)>0.5
 u1=$w
 good=out
 bad=$cc
!else
 good=$cc
 u1=$u
!endif

