|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.algorithm.util.RandomTools
public class RandomTools
This class provides several static methods for generating random numbers and sets
Constructor Summary | |
---|---|
RandomTools()
|
Method Summary | |
---|---|
static int |
binomial(int n,
double p,
Random rnd)
Returns a pseudorandom number drawn from binomial distribution B(n, p). |
static double |
exponential(Random rnd)
Returns a pseudorandom number drawn from exponential distribution with mean 1. |
static Set<Integer> |
randomKsubset(int n,
int k,
Set<Integer> subset,
Random rnd)
Generates a pseudorandom subset of size k of the set {0, 1,... |
static Set<Integer> |
randomPsubset(int n,
double p,
Set<Integer> subset,
Random rnd)
Generates a pseudorandom subset of the set {0, 1,... |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomTools()
Method Detail |
---|
public static double exponential(Random rnd)
rnd
- source of randomness
public static int binomial(int n, double p, Random rnd)
n
- number of triesp
- success probabilityrnd
- source of randomness
public static Set<Integer> randomKsubset(int n, int k, Set<Integer> subset, Random rnd)
n
- the size of the initial setk
- the size of the generated setsubset
- if not null, this set is cleared and the result is stored
here. This avoids creations of sets at each call of this
methodrnd
- source of randomness
public static Set<Integer> randomPsubset(int n, double p, Set<Integer> subset, Random rnd)
n
- the size of the initial setp
- the probability to choose each elementsubset
- if not null, this set is cleared and the result is stored
here. This avoids creations of sets at each call of this
methodrnd
- source of randomness
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |