This order is complex as it follows a configuration (see the Navigation config in the Admin UI), including Pinned Pages. So you’ll need to also follow it in your code.
Note that this is only direct children, and if there are a lot (like a few hundreds of thousands ;)), it won’t scale very well.
Also there’s no specific order, as you’ve noticed.
If you want to sort the best is to sort using a XWQL query.
Right now getchildren() does:
Query query = getStore().getQueryManager()
.createQuery("select distinct doc.fullName from XWikiDocument doc where "
+ "doc.parent=:prefixedFullName or doc.parent=:fullName or (doc.parent=:name and doc.space=:space)",
Query.XWQL);
query.addFilter(Utils.getComponent(QueryFilter.class, "hidden"));
query.bindValue("prefixedFullName",
getDefaultEntityReferenceSerializer().serialize(getDocumentReference()));
query.bindValue("fullName", LOCAL_REFERENCE_SERIALIZER.serialize(getDocumentReference()));
query.bindValue("name", getDocumentReference().getName());
query.bindValue("space",
LOCAL_REFERENCE_SERIALIZER.serialize(getDocumentReference().getLastSpaceReference()));
query.setLimit(nb).setOffset(start).setWiki(wikiReference.getName());
List<String> queryResults = query.execute();
If you want to sort on the real title, then it’s more complex, you’ll need to retrieve the title and perform a sort on that. It’s also a lot more costly.