When I create records using the SOAP API, the Id of the created records are returned, and if multiple records are created in a single call, all the Ids are returned. I'm just wondering if there's any guarantee that the order of the returned Ids matches the order that the records were submitted in the call, or is it purely random?
The order is guaranteed. From the docs
The create() call returns an array of SaveResult objects. Each element in the SaveResult array corresponds to the sObject array passed as the sObjects parameter in the create() call. For example, the object returned in the first index in the SaveResult array matches the object specified in the first index of the sObject array. A SaveResult object has the following properties: