Look at this slightly modified version of your program. It has the advantage that this code runs then ends. I ran it on the go playground for 10 times, one out of those 10 times it printed first “even 2” otherwise it was “odd 2”.
The thing which decides what goroutine runs first, is how the 2 goroutines are scheduled at runtime. The first goroutine has a slight advantage over the second, as main first launches it then the second.
Once either of the two goroutine has started running, then because it writes on a channel while the other goroutine waits reading from that same channel, the order is fixed.
@NobbZ & @aceix stop bashing on OP please, his question is legitimate even if poorly worded.
I’m not bashing. I always use weather or solar flares as an exaggeration for non deterministic randomness far beyond our control. If this is perceived as “bashing” I’m sorry about that, this really wasn’t what I wanted to do.