<p>Link here:</p>
<p><a href="https://golang.org/pkg/math/rand/#Zipf">https://golang.org/pkg/math/rand/#Zipf</a></p>
<p>Seems fairly arbitrary... No Gaussian?</p>
<hr/>**评论:**<br/><br/>jlund3: <pre><p>For sampling from a Gaussian, <a href="https://golang.org/pkg/math/rand/#NormFloat64">NormFloat64</a> has you covered. Just multiply the Normal distribution by your standard deviation and add in your mean.</p></pre>fancy_pantser: <pre><p>As for why it provides Zipf distributions: back in 12/2009 (long before Go 1, just a month after it was announced to the public), William Josephson added it with <a href="https://github.com/golang/go/commit/52114724b779d2826746dfc3c2475f659bbd7961" rel="nofollow">this commit</a> and we see some feedback in <a href="https://codereview.appspot.com/176070" rel="nofollow">this review</a> but no reasoning on why he wanted to add it. The <a href="http://golang-nuts.narkive.com/7cjy5i2N/release-2009-12-22" rel="nofollow">release notes</a> mention it but no reason either.</p>
<p>I can only imagine that Googlers wanted to have it in there because Zipf's law is often used in Natural Language Processing (NLP) and simulation thereof. The zeta distribution has many other uses, of course.</p>
<blockquote>
<p>Zipf's law states that given some corpus of natural language utterances, the frequency of any word is inversely proportional to its rank in the frequency table.</p>
</blockquote></pre>
