There is nothing random about Evolution.
I'm wondering if there's a difference between finding patterns and finding goals or teleology. Stars are created, exist, and die following certain kinds of patterns. Stars fall along the spectrum of the main sequence. And the reason stars have these similarities is due to the nature of physics. There are no "random" star types, technically speaking. But I'm not sure it makes sense to say that stars are directional, unless we just mean that they are part of a causal chain bound by the laws of nature.
It seems like one could say that biology converges on certain types because that's what works. Eyes keep emerging because those that have them reproduce. Arms and legs emerge because those that have them reproduce. Other types of bodies that we could imagine simply don't get off the ground (evolutionarily speaking) in this kind of universe.
It could be true that humanoids are a form that work well (or well enough) in this kind of universe--just like red dwarf stars. But what we are seeing are certain kinds of patterns, not because they are aimed at but because they survive to tell their tale.
I don't know just how it works, to "compare the biological code with millions of random variations," but I doubt that we have the computing power to anticipate all the endless forms that evolutionary processes can yield. We are not smarter than evolution.
I'm sure it's standard principle of ethology, that adventitious factors rooted in the pre-biological natural world place constraints on evolution. But those constraints themselves are subject to significant variation. A planet of slightly different size, and hence with slightly different gravity, could produce a significantly different array of body-plans than what we see on Earth. So many variables from the nonliving world can come into play: distance of the planet from the galactic center, type of star the planet orbits and just where in the Goldilocks zone the planet lies, strength of the planet's magnetic field, etc. Certainly it's likely that there exist planets in the cosmos that are even MORE favorable to life than the Earth is. It takes some hubris to assume that we can decree what kinds of life forms are possible, and which are not, merely from our biosphere-sample of one, here.