搜索了一圈没有找到合适的代码,有matlab的R的但是看不太懂,项目需求又很急···
stackoverflow问题:
https://stackoverflow.com/questions/2592375/power-law-distribution-for-a-given-exponent-in-c-sharp-using-mathnet
官网介绍:
https://numerics.mathdotnet.com/api/MathNet.Numerics.Distributions/Pareto.htm
https://numerics.mathdotnet.com/Probability.html
项目地址:
https://github.com/mathnet/mathnet-numerics
思路很简单,首先生成一组随机数(均匀分布),然后得到每个随机数-平均数(正态分布),然后得到每个区间段正态分布数的个数,再按照从大到小排序,此时就是幂律分布。