|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgps.util.PowerLaw
public class PowerLaw
provides power law selection. Modified by Weishuai Yang this file is based on T J Finney's Manuscripts Simulation Tool, 2001
| Constructor Summary | |
|---|---|
PowerLaw()
constructs a power law object using an internal random generator |
|
PowerLaw(java.util.Random r)
constructs a power law object using an external random generator |
|
| Method Summary | |
|---|---|
double |
getRand()
get uniformly distributed double in [0, 1] |
int |
getRandInt(int N)
get uniformly distributed integer in [0, N - 1] |
static void |
main(java.lang.String[] args)
test purpose main |
int |
select(double[] nums,
double p)
selects item using power law probability of selecting array item: p(ni) = k * (ni^p) k is a normalisation constant p(ni) = 0 if ni is zero, even when p < 0 |
int |
zipf(int size)
select item using Zipf's law |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PowerLaw(java.util.Random r)
r - random generator passed inpublic PowerLaw()
| Method Detail |
|---|
public double getRand()
public int getRandInt(int N)
public int select(double[] nums,
double p)
nums - array of numbers nip - exponent p
public int zipf(int size)
size - of ranked array
public static void main(java.lang.String[] args)
args - command line inputs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||