The Buddhabrot is closely related to the Mandelbrot Set, a point in the set represents the probability of the trajectory of the Mandelbrot function to hit.
The easiest method to render the Buddhabrot is to randomly sample points and check if they escape towards infinity for a finite number of steps (using a set maximum number). If they do escape, the trail of points gets added to the Buddhabrotset.
After evaluating a high enough number of points we can render the Buddhabrot based on the probability of the points hitting a certain spot.
The following pseudo code hopefully illustrates this concept better:
Function ApproximateBuddhabrot(n : number of points to sample)
result : 2D density map
for i := 1 to n do
z = random point close to mandel brot set
for j := 1 to max_iter do
z = f(z) // f is the step function of the mandelbrot set
if ||z||^2 > 2 do break
if j < max_iter
for j := 1 to max_iter do
z = f(z)
result[z] += result[z] + 1
if ||z||^2 > 2 do break
return result
