Species don’t evolve to solve a problem, they evolve randomly and sometimes that solves a problem for them.
Eh… they mutate randomly, and then selection acts. If there is variation that solves a problem, selection will promote that variation.
Evolution is very much not random, it is a direct consequence of variation and selection. This does not mean that they evolve to solve problems, but problems often drive evolution.
I’ll just leave this here https://beautiful.makie.org/dev/examples/2d/histogram/hist