From what I remember, pk3DS assigns new mega pkm by checking if the held item is a mega stone. By randomizing held items (and some get a mega stone), and randomizing again, you'd end up with a mega.
Just don't randomize again (if held items are randomized) to avoid this.