Originally Posted by kovidgoyal
As far as I recall there is no particular algorithm used for this. If you are importing from a set of directories created by the save to disk button, then the OPF file will be used in preference, otherwise it is random.
I looked at this recently. I got the impression that after checking for the opf file, it just asked the OS to provide all the files and processed sequentially whatever the OS provided, so it probably has to do with directory order as the directory tree gets scanned. I'm not sure "random" is technically correct, but effectively, that's what you'd see.