#include #include #define N 1000000 int main() { double x,y,x1,y1,r; int i; x=0; y=0; i=N; while(i) { r=(double)rand()/RAND_MAX; printf("%lf %lf\n", x,y); if(r<0.65) { x1=0.5*x+0.5; y1=0.5*y; } else if(r<0.8) { x1=0.5*x+0.5; y1=0.5*y+0.5; } else if(r<0.9) { x1=0.5*x; y1=0.5*y+0.5; } else { x1=0.3*x+0.3; y1=0.3*y+0.3; } x=x1; y=y1; i--; } return 0; }