I'm trying to generate p2p network according to power law distribution. How to generate power law distribution in java? does it have any library?
thanks :)
I'm trying to generate p2p network according to power law distribution. How to generate power law distribution in java? does it have any library?
thanks :)
Maybe the Colt java library can help. It generates random numbers according to many distributions.
Apache Commons Math library has an implementation for Zipf's distribution, which is a power law.
If you can't/don't want to use a library:
In this case, the easiest way to go is to work out the CDF (check it against Wikipedia), that is the function F : x -> P(X < x). Then you draw uniform random numbers y on [0,1] with your favorite generator, and you solve y = F(x). The sequence of such x are identically distributed and follow a Power Law Distribution.
Edit: the answer is there