That's just the typical way of how a so called "boundary" between different parts of a mime structure is defined. The receiving side can tell the different parts apart by this. Same logic is used in different things, email messages too for example.
That "random" string is indeed random, all boundary markers using an identical string are "grouped", so working on the same level. Mime part structures can stacked in a hierarchical manner. In such case different random strings are used in different levels to tell them apart. This is for example how citing an email as attachment to a new email. If the cited email contains multiple mime parts, their boundaries must be different to those of the new email, otherwise confusion would arise between the levels.
Actually it is not the "random part" of that boundary that counts. The whole string is matched. It is simply a convention that each software uses a unique prefix string for such boundaries for transparency reasons. But in general the only requirement is that the chosen string must be unique throughout all contained data. Unique obviously except for the corresponding boundaries which must use exactly the same string.