This applet generates a Sierpinski carpet. If you look at the Java source code you will see that it generates a random number, and then with probability 1/8 does the following:
The key omission, in order to create the Sierpinski carpet holes, is that zero probability is assigned to the possibility
Xnew = X/3 + .3333333333333333;This omission creates a hole at each smaller level of the carpet.
Ynew = Y/3 + .3333333333333333;