Randomly Generate Letters According to their Frequency of Use?
How can I randomly generate letters according to their frequency of use in common speech? Any pseudo-code appreciated, but an implementation in Java would be fantastic. Otherwise just a poke in the right direction would be helpful. Note: I don't need to generate the frequencies of usage - I'm sure I can look that up easily enough. I am assuming that you store the frequencies as floating point numbers between 0 and 1 that total to make 1. First you should prepare a table of cumulative frequencies, i.e. the sum of the frequency of that letter and all letters before it. To simplify, if you start