The arbitrariness of the gender of names frustrates many Spanish English-speaking learners, but it is not necessary. Alemán Bañón, J., Fiorentino, R., and Gabriele, A. (2012). The treatment of number and gender matches in Spanish: a potential study linked to an event of the effects of structural distance. Brain Res. 1456, 49–63. doi: 10.1016/j.brainres.2012.03.057 If you answer: „The male sex is always used when there is a mixed group“, you are already thinking in the same direction as the Spanish language. Jakubowicz, C., and Faussart, C. (1998). Correspondence between the sexes in the treatment of French spoken. J.
Psycholinguist. Res. 27, 597-617. doi: 10.1023/A:1023297620824 In the recent history of the Spanish language, there is a unidirectional tendency to regularize words of unusual gender by analogy with other words in their class. For example, the word idioma („language“), which is masculine in standard Spanish, has become feminine in some dialects.  Kupisch, T., Akpinar, D., and Stöhr, A. (2013). Gender assignment and matching between bilingual adults and second-language French learners.
Linguist. Biling approach. 3, 150–179. doi: 10.1075/lab.3.2.02kup Ambiguous names (ambiguo), whose grammatical gender varies in usage, are said to be of the „ambiguous“ gender. Often, the change of sex leads to a change in connotation. Z.B.: el mar („the sea“), la mar („the sea“, poetic or among sailors), el calor („heat“), la calor („archaic“), el azúcar, la azúcar („sugar“).  This means that, for example, when I say a car is yellow, the word „yellow“ must have the same gender and number as „car.“ .