1. A method comprising: selecting multiple languages for a keyboard to be optimized; obtaining a text corpus for each of the multiple languages; analyzing the text corpus for each of the multiple languages to obtain a diagram frequency table; selecting key positions for characters on the keyboard to be optimized; selecting constraints for the key positions for the characters on the keyboard; and using the Metropolis method to determine placement for the positions of the characters on the keyboard for higher user input speed on the keyboard to be optimized, based on the digram frequency table and additional constraints.