jj,
Well, my second solution should serve to check for stability. Assuming that the data records contain two DWORDS (a QWORD) then set two DWORD keys to the same random value, and then set the other DWORD in each QWORD to an incrementing value, then select a new random value for the keys and save the next two keys the the same value ans continue incrementing the value to save in the second DWORD of each record. After the sort has ordered the records, check that pairs of matching DWORD keys have an ascending second DWORD. The second field does not have to be another DWORD, but needs to be at least large enough to contain the incremented second value. Note that this is a requirement to insure that if there were more than 2 keys with the same value, that they were correctly positioned in the output with ascending second DWORD values. If there would be only 2 DWORDS with matching keys (that is, never more than 2 consecutive DWORDS with the same key value), then a single byte could be used to contain a 0 and a 1 value and repeat the 0 and 1 for all other second DWORD pairs, but this would not completely test the stability. Essentially, if you only had a DWORD array and wanted to sort it by DWORDS, then you would have to be able to color the DWORDS Red and Green in order to check stability, but this is ridiculous because the entire DWORD is the entire record and if two DWORDS match, then it doesn't matter whether the sort is stable. Stability is only important when other data is present along with the key data.
Dave.