Chaos game

One of the most well known mathematical creatures is the [url=https://en.wikipedia.org/wiki/Sierpinski_triangle]Sierpinski triangle[/url]. A funny way to create this type of fractal is the [url=https://en.wikipedia.org/wiki/Chaos_game]chaos game[/url], by choosing initially an arbitrary point P and then randomly choosing one of the vertices of a given triangle, finally compute the midpoint of P and the randomly chosen vertex: this will be the new point P. Now the set of traces of P will look like the Sierpinski triangle.
It is surprisingly easy to create such an applet with GeoGebra:[br][list=1][*]Create a slider and start animating it.[br][/*][*]Create the point P and set its trace on.[/*][*]Create the triangle ABC.[/*][*]Add this piece of code to the Scipting > On Update setting for the slider:[code][/code][br][code]T=If[RandomBetween[1,3]==1,A,If[RandomBetween[1,2]==1,B,C]][/code][br][code]P=Midpoint[T,P][/code][br][/*][/list]

Information: Chaos game