Split the traffic between 2 domains using workers

Hi All,
The scenario is simple. We have created a new mobile site which is hosted in m. (mobile) subdomain, So now want try kind of AB tests which splits traffic (50% each) between these two domains.
50 % <domain.com>
50 % m.<domain.com>

is This possible with Cloudflare workers? any Example to look at, please?

There is a page in the documentation about that…