Prepare a 2d tensor with random values from normal distribution.
Let then round these numbers to 0s (white) and 1s (black) depending on the intensity.
Code:
m = np.random.rand(size, size)
m = np.where(m < intensity, 0, 1)
Let now count number of clusters that contains 0s and 1s.
I have prepared the code for this problem and the plot looks like:
It seems that 2d white noise can be the most intensive at: $$x \approx 0.73$$
I have found a function for the same problem, but with 1d tensor it is: $$(1 - x) x$$
For 2d, 3d, ... tensors, I have no idea how to approach this problem. I also found that it is a problem from percolation theory.
How to find ideal function for this problem?

