I saw a piece of codes like:
ClearAll["Global`*"];
t0 = AbsoluteTime[];
list = {{0, 0}};
last = {{0}, {0}};
GetNextPoint[pt_] := Module[{r,
t1 = {{0.83, 0.03}, {-0.03, 0.86}}, p1 = {0, 1.5},
t2 = {{0.2, -0.25}, {0.21, 0.23}}, p2 = {0, 1.5},
t3 = {{-0.15, 0.27}, {0.25, 0.26}}, p3 = {0, 0.45},
t4 = {{0, 0}, {0, 0.17}}, p4 = {0, 0}},
r = Random[];
If[r <= 0.85, t1.pt + p1,
If[r <= 0.91, t2.pt + p2, If[r <= 0.99, t3.pt + p3, t4.pt + p4]]]]
For[i = 0, i < 100000, i++, last = GetNextPoint[last];
list = Append[list, First[Transpose[last]]];]
h = ListPlot[list, PlotStyle -> {PointSize[0.002], Red},
Axes -> False];
range = First /@ Differences /@ (PlotRange /. Options[h]);
Show[h, AspectRatio -> Last@range/First@range]
Print[AbsoluteTime[] - t0]
which generates the following fractal picture after one or two minutes:

What is the mathematical principles behind the code? What kind of matrices can also lead to fractals? And how can I create similar fractals with different matrices?
EDIT
Someone suggested a more efficient code:
Clear["`*"];
t0 = AbsoluteTime[];
ifs[prob_, A_, init_, maxIter_] :=
FoldList[#2.{#[[1]], #[[2]], 1} &, init,
RandomChoice[prob -> A, maxIter]];
init = {0., 0.};
prob = N@{85, 6, 8, 1};
A = N@{{{0.83, 0.03, 0}, {-0.03, 0.86, 1.5}}, {{0.2, -0.25, 0}, {0.21,
0.23, 1.5}}, {{-0.15, 0.27, 0}, {0.25, 0.26, 0.45}}, {{0, 0,
0}, {0, 0.17, 0}}};
iter = 10^5;
pts = ifs[prob, A, init, iter];
Graphics[{PointSize[0.002], Green, Point[pts]}, Background -> Black]
Print[AbsoluteTime[] - t0]