Does anyone know of any good Random Data libraries, that come with some Johann Carl Friedrich Gauss style algorithms?

blov · · 438 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Right now I am using the <strong>math/rand</strong> package, but it seems kind of basic, especially when it comes to generating random Float32&#39;s. Additionally there seems to be no method for generating floats between a certain range. Right now I am just randomly generating normal integers and using a float like 13.0 as a dominator. </p> <p>What is Go&#39;s version of NPM? I seem to have a hard time finding open source libraries for Go.</p> <hr/>**评论:**<br/><br/>coltstrgj: <pre><p>You cannot generate numbers in a range and still be Gaussian. You can specify an certainty that a value falls in a range, but cannot guarantee it. This is just a math thing, but really doesn&#39;t matter that much to you because the numbers we generate are close. </p> <p>You can approximate Gaussian by averaging a few of these linearly distributed random numbers from math/rand. </p> <p><a href="https://play.golang.org/p/n93Sc-u7Mq" rel="nofollow">Here</a> is some example code that I think will do what you are looking for. </p> <p><a href="https://docs.google.com/spreadsheets/d/1CmSrNbiU8O_7wy4hZtPyc-lhxNKzILW4Cug4E57Ca44/edit?usp=sharing" rel="nofollow">Here</a> is a quick sample of what the example code I posted generates.</p></pre>TheBeardofGilgamesh: <pre><p>That&#39;s awesome thanks! Also, yeah certainty is what I was looking for since it&#39;s a simulation I just wanted to contain the fluctuations so that the variance falls in a normal distribution on par with the Forex/Stocks actual historical range[June 2016]. The actual implementation I made that produces floats via division of a random Int within a range over a Float64 denominator looks really weird since the chart looks like a zig zag always contained within it&#39;s Y axis range, like Homer Simpson&#39;s hair. </p> <p>Anyways, this is great stuff, thanks a lot I really appreciate it! </p></pre>coltstrgj: <pre><p>No problem, I was something I had to figure out for a project recently as well. </p></pre>whiteraven-: <pre><p>You can search for open source projects at <a href="https://godoc.org" rel="nofollow">godoc</a></p></pre>epiris: <pre><p>Search go-faker. If I recall some people have inenebted the python / nodejs faker libraries (I don&#39;t remember which came first, pardon my ignorance here). If you want more structured bulk data from real world stuff, the government has probably the best site I&#39;ve found for this. I&#39;ve used it numerous times for all kinda of purposes. It can be a bit less boring to look at as you develop too. <a href="HTTP://data.gov" rel="nofollow">HTTP://data.gov</a> (might need to click developers or API or something, sorry, on mobile.)</p></pre>intermernet: <pre><p>A Google search for &#34;golang gaussian&#34; had <a href="https://github.com/leesper/go_rng" rel="nofollow">this</a> as the fourth result. Hopefully it&#39;s approximately what you&#39;re after. I&#39;ve not used it, or read the code, but it definitely has a <a href="https://github.com/leesper/go_rng/blob/master/gauss.go" rel="nofollow">Gaussian PRNG function</a>.</p> <p>It says it has implementations of:</p> <ul> <li>Uniform Distribution </li> <li>Bernoulli Distribution </li> <li>Chi-Squared Distribution </li> <li>Gamma Distribution </li> <li>Beta Distribution </li> <li>Fisher&#39;s F Distribution </li> <li>Cauchy Distribution </li> <li>Weibull Distribution </li> <li>Pareto Distribution </li> <li>Log Normal Distribution </li> <li>Exponential Distribution </li> <li>Student&#39;s t-Distribution </li> <li>Binomial Distribution </li> <li>Poisson Distribution </li> <li>Geometric Distribution </li> <li>Gaussian Distribution </li> <li>Logistic Distribution </li> <li>Dirichlet Distribution</li> </ul> <p>But I have no idea if they are implemented correctly or not.</p> <p>General rule of thumb: The language is called &#34;Go&#34;, but always Google for &#34;golang&#34; :-) </p></pre>coltstrgj: <pre><p>This last part is a good tip. It took me a very long time to figure out to search for golang instead of Go. </p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

438 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传