'-------------------- Mountains -------------
DIM x(3), y(3), F(3), a(3),b(3),c(3),d(3),e(3),ff(3)
x(0)=0: x(1)=30: x(2)=60: x(3)=100
F(0)=0: F(1)=50: F(2)=40: F(3)=10
d(1)=.5: d(2)=-.5: d(3)=.23
BackColor 305
CLS
FOR n=1 TO 3
b=x(3)-x(0):
a(n)=(x(n)-x(n-1))/b
e(n)=(x(3)*x(n-1)-x(0)*x(n))/b
c(n)=(F(n)-F(n-1)-d(n)*(F(3)-F(0)))/b
ff(n)=(x(3)*F(n-1)-x(0)*F(n)-d(n)*(x(3)*F(0)-x(0)*F(3)))/b
NEXT n
ForeColor 30
x=0: y=0
FOR n=1 TO 10000
K=INT(3*RND-.0001)+1
xx=a(K)*x+e(K)
yy=c(K)*x+d(K)*y+ff(K)
x=xx: y=yy
LINE(6.2*x,400+2*s-5*y)-(6.2*x,450)
NEXT n
FOR s=1 TO 350
x=0: y=0
FOR n=1 TO 1000
K=INT(3*RND-.0001)+1
xx=a(K)*x+e(K)
yy=c(K)*x+d(K)*y+ff(K)
x=xx: y=yy
ForeColor s+60+33*RND
LINE(6.2*x,430+s-5*y)-(6.2*x,450)
NEXT n,s
LOCATE 1,1: INPUT z