Ok, found it.
Why does X/Y freeze when entering a battle?
Apart from randomizing trainer pokemons, if you select ANY other option to be randomized, game freezes
Although most randomizing option does not give any error, the game still freezes before entering battles in X/Y.
One specific error with Pokemon X is when randomizing in personal editor.
InvalidArgument=Value of "187" is not valid for "SelectedIndex"