And so please tell what standard against which this process of trial and error non-random! as you say (but it still looks pretty random to me, especially if we are to think of it as "goal-less" and "undirected") is to be measured? What is the standard that decides what works and what doesn't work in Nature? Especially if Nature is said to have no purposes of her own?
If there are no purposes in Nature, then how can natural selection not be random ?
As to what standard is used in this trial and error it is known in biology as “differential reproductive success”. A favored variation will have leave more offspring than a unfavorable variation.
This is what is observed in countless experiments on the ability of natural selection to shape experimental populations. If you turn up the heat on a population, those variations amenable to high heat have more offspring.
What “works” in nature is surviving and reproducing.
What “doesn't work” is dying before you reproduce, having sickly or few offspring, etc.
Detection of “purpose” is beyond the scope of science.
If I lose at cards then I see it as God's will.
An atheist may well see it as just random bad luck.
There is no scientific way to differentiate or discern between these two views.