I've heard that it's random but the pool of randomness is somewhat decided by the stats the item gives before it's converted.