Configure Linux to prefer IPv6

It surprised me to find out that some distributions of Linux don't prefer IPv6. I had assumed that given an hostname returning both A and AAAA records, IPv6 would be used for the connection. I know that browsers implement a "fastest wins" connection ...