fork download
import Image, ImageDraw, random
 
#from http://c...content-available-to-author-only...e.com/recipes/577111-mandelbrot-fractal-using-pil/
# Mandelbrot fractal
# FB - 201003254
# drawing area
xa = -2.0
xb = 1.0
ya = -1.5
yb = 1.5
maxIt = 255 # max iterations allowed
# image size
imgx = 512
imgy = 512
image = Image.new("RGB", (imgx, imgy))

x = .3
y = -.1

for i in xrange(100000):
	c = random.randint(0,2)
	if c is 0:
		x = x/2.0
		y = y/2.0
	if c is 1:
		x = (x+1)/2.0
		y = (y)/2.0
	if c is 2:
		x = x/2.0
		y = (y+1)/2.0
	cx = x * imgx
	cy = y * imgy
	if x >= 0 and y >= 0 and x < imgx and y < imgy and i > 20:
            image.putpixel((int(cx), int(cy)), (255,255,255))
        
		
		
 
# ideone output
import StringIO
output = StringIO.StringIO()
image.save(output, 'PNG')
contents = output.getvalue()
output.close()
print contents
Success #stdin #stdout 0.91s 12016KB
stdin
Standard input is empty
stdout