It's not random.
Crafter's equipment -> Crafter Materia (+Control, Craftsmanship, CP)
Gatherer's equipment -> Gatherer Materia (+Gather, Perception, GP)
DoW equipment -> DoW beneficial Materia (STR, DEX, VIT, +Determination, +Acc, +Crit Rate, +Skill Speed, +Parry) It actually gone quite more specific than that e.g tank equipment turn into VIT/Parry
DoM equipment -> DoM beneficial Materia (INT, MND, PIE, +Determination, +Acc, +Spell Speed etc.)
The resistance materia I don't quite sure know which but most likely come from Shield slot (?)