Java: power distribution

I am trying to create a p2p network according to the distribution of the law of power. How to generate power law distribution in java? Does he have a library?

thank:)

+3
source share
5 answers

The Apache Commons Math library has an implementation for distributing Zipf , which is a power law.

+4
source

If you cannot / do not want to use the library:

CDF ( Wikipedia), F: x → P (X < x). y [0,1] , y = F (x). .

:

+4
+3

Apache Commons Math lib (, - ...). PowerLaw.java .

+1

This library: https://github.com/pbloem/powerlaws contains a power law generator used as follows:

List<Double> data = new Continuous(3.14, 2.5).generate(1000);

This generates 1000 points from the power law distribution with 3.14 as the minimum value and 2.5 as an exponent. It also has a discrete distribution and a continuous approximation of a discrete distribution. All of these distributions can also match existing data.

(Disclaimer: I wrote this library).

+1
source

Source: https://habr.com/ru/post/1754766/


All Articles