When creating a transaction in the standard client, what is the algorithm used to determine which unspent outputs will be used as inputs?
Has this changed since the first version? What different algorithms are used by alternative clients?
Does the client make any attempt to optimize which 'coins' are used based on minimizing the transaction size, the resulting fragmentation, or the 'age' of the coins (value/transactions) used as the source?