letterFrequency.frink

View or download letterFrequency.frink in plain text format


/** This is the letter frequency for English, as analyzed here:

    http://norvig.com/mayzner.html

    and corrected slightly so that the probabilities sum to 1.

    You can generate a random selection of these letters with the
    DiscreteDistribution.frink sample program:

    use DiscreteDistribution.frink
    dd = new DiscreteDistribution[letterFrequencies]
    for a = 1 to 25
       print[dd.random[]]
*/


letterFrequencies = [["E", 12.50 percent],
  ["T", 9.29 percent],
  ["A", 8.04 percent],
  ["O", 7.64 percent],
  ["I", 7.57 percent],
  ["N", 7.23 percent],
  ["S", 6.51 percent],
  ["R", 6.28 percent],
  ["H", 5.05 percent],
  ["L", 4.07 percent],
  ["D", 3.82 percent],
  ["C", 3.34 percent],
  ["U", 2.73 percent],
  ["M", 2.51 percent],
  ["F", 2.40 percent],
  ["P", 2.14 percent],
  ["G", 1.87 percent],
  ["W", 1.68 percent],
  ["Y", 1.66 percent],
  ["B", 1.48 percent],
  ["V", 1.05 percent],
  ["K", 0.54 percent],
  ["X", 0.23 percent],
  ["J", 0.16 percent],
  ["Q", 0.12 percent],
  ["Z", 0.09 percent]]


View or download letterFrequency.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17683 days, 14 hours, 27 minutes ago.