Commit ce7712d0 authored by Manoel Campos's avatar Manoel Campos

Improved documentation of classes from package org.cloudbus.cloudsim.distributions.

It was made clear that the classes are generators of pseudo random numbers following a given distribution.
A link to the distribution's Wikipedia page was included for each class.
parent c1fcece5
...@@ -17,9 +17,10 @@ package org.cloudbus.cloudsim.distributions; ...@@ -17,9 +17,10 @@ package org.cloudbus.cloudsim.distributions;
public interface ContinuousDistribution { public interface ContinuousDistribution {
/** /**
* Sample the random number generator. * Generate a new pseudo random number.
* *
* @return The sample * @return the next pseudo random number in the sequence,
* following the implemented distribution.
*/ */
double sample(); double sample();
......
...@@ -11,19 +11,20 @@ package org.cloudbus.cloudsim.distributions; ...@@ -11,19 +11,20 @@ package org.cloudbus.cloudsim.distributions;
import org.apache.commons.math3.distribution.ExponentialDistribution; import org.apache.commons.math3.distribution.ExponentialDistribution;
/** /**
* An exponential number generator. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Exponential_distribution">Exponential distribution</a>.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
*/ */
public class ExponentialDistr implements ContinuousDistribution { public class ExponentialDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal exponential number generator. */
private final ExponentialDistribution numGen; private final ExponentialDistribution numGen;
/** /**
* Creates a new exponential number generator. * Creates a new exponential pseudo random number generator.
* *
* @param seed the seed to be used. * @param seed the seed to be used.
* @param mean the mean for the distribution. * @param mean the mean for the distribution.
...@@ -34,7 +35,7 @@ public class ExponentialDistr implements ContinuousDistribution { ...@@ -34,7 +35,7 @@ public class ExponentialDistr implements ContinuousDistribution {
} }
/** /**
* Creates a new exponential number generator. * Creates a new exponential pseudo random number generator.
* *
* @param mean the mean for the distribution. * @param mean the mean for the distribution.
*/ */
...@@ -42,11 +43,6 @@ public class ExponentialDistr implements ContinuousDistribution { ...@@ -42,11 +43,6 @@ public class ExponentialDistr implements ContinuousDistribution {
numGen = new ExponentialDistribution(mean); numGen = new ExponentialDistribution(mean);
} }
/**
* Generate a new random number.
*
* @return the next random number in the sequence
*/
@Override @Override
public double sample() { public double sample() {
return numGen.sample(); return numGen.sample();
......
...@@ -14,18 +14,19 @@ import java.util.Random; ...@@ -14,18 +14,19 @@ import java.util.Random;
import org.apache.commons.math3.distribution.GammaDistribution; import org.apache.commons.math3.distribution.GammaDistribution;
/** /**
* The Class GammaDistr. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Gamma_distribution">Gamma</a> distribution.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
*/ */
public class GammaDistr implements ContinuousDistribution { public class GammaDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal Gamma pseudo random number generator. */
private final GammaDistribution numGen; private final GammaDistribution numGen;
/** /**
* Instantiates a new gamma distr. * Instantiates a new Gamma pseudo random number generator.
* *
* @param seed the seed * @param seed the seed
* @param alpha the alpha * @param alpha the alpha
...@@ -37,7 +38,7 @@ public class GammaDistr implements ContinuousDistribution { ...@@ -37,7 +38,7 @@ public class GammaDistr implements ContinuousDistribution {
} }
/** /**
* Instantiates a new gamma distr. * Instantiates a new Gamma pseudo random number generator.
* *
* @param alpha the alpha * @param alpha the alpha
* @param beta the beta * @param beta the beta
...@@ -46,10 +47,6 @@ public class GammaDistr implements ContinuousDistribution { ...@@ -46,10 +47,6 @@ public class GammaDistr implements ContinuousDistribution {
numGen = new GammaDistribution(shape, scale); numGen = new GammaDistribution(shape, scale);
} }
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override @Override
public double sample() { public double sample() {
return numGen.sample(); return numGen.sample();
......
...@@ -13,7 +13,8 @@ import java.util.Random; ...@@ -13,7 +13,8 @@ import java.util.Random;
import org.apache.commons.math3.distribution.LogNormalDistribution; import org.apache.commons.math3.distribution.LogNormalDistribution;
/** /**
* The Class LognormalDistr. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">Lognormal</a> distribution.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
...@@ -21,12 +22,12 @@ import org.apache.commons.math3.distribution.LogNormalDistribution; ...@@ -21,12 +22,12 @@ import org.apache.commons.math3.distribution.LogNormalDistribution;
public class LognormalDistr implements ContinuousDistribution { public class LognormalDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal Log-normal pseudo random number generator. */
private final LogNormalDistribution numGen; private final LogNormalDistribution numGen;
/** /**
* Instantiates a new lognormal distr. * Instantiates a new Log-normal pseudo random number generator.
* *
* @param seed the seed * @param seed the seed
* @param mean the mean * @param mean the mean
...@@ -38,7 +39,7 @@ public class LognormalDistr implements ContinuousDistribution { ...@@ -38,7 +39,7 @@ public class LognormalDistr implements ContinuousDistribution {
} }
/** /**
* Instantiates a new lognormal distr. * Instantiates a new Log-normal pseudo random number generator.
* *
* @param mean the mean * @param mean the mean
* @param dev the dev * @param dev the dev
...@@ -47,10 +48,6 @@ public class LognormalDistr implements ContinuousDistribution { ...@@ -47,10 +48,6 @@ public class LognormalDistr implements ContinuousDistribution {
numGen = new LogNormalDistribution(scale, shape); numGen = new LogNormalDistribution(scale, shape);
} }
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override @Override
public double sample() { public double sample() {
return numGen.sample(); return numGen.sample();
......
...@@ -11,7 +11,9 @@ package org.cloudbus.cloudsim.distributions; ...@@ -11,7 +11,9 @@ package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class LomaxDistribution. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Lomax_distribution">
* Lomax distribution</a>.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
...@@ -22,7 +24,7 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu ...@@ -22,7 +24,7 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu
private final double shift; private final double shift;
/** /**
* Instantiates a new lomax distribution. * Instantiates a new lomax pseudo random number generator.
* *
* @param shape the shape * @param shape the shape
* @param location the location * @param location the location
...@@ -39,7 +41,7 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu ...@@ -39,7 +41,7 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu
} }
/** /**
* Instantiates a new lomax distribution. * Instantiates a new lomax pseudo random number generator.
* *
* @param seed the seed * @param seed the seed
* @param shape the shape * @param shape the shape
...@@ -56,10 +58,6 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu ...@@ -56,10 +58,6 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu
this.shift = shift; this.shift = shift;
} }
/*
* (non-Javadoc)
* @see cloudsim.distributions.ParetoDistr#sample()
*/
@Override @Override
public double sample() { public double sample() {
return super.sample() - shift; return super.sample() - shift;
......
...@@ -14,18 +14,19 @@ import java.util.Random; ...@@ -14,18 +14,19 @@ import java.util.Random;
import org.apache.commons.math3.distribution.ParetoDistribution; import org.apache.commons.math3.distribution.ParetoDistribution;
/** /**
* The Class ParetoDistr. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Pareto_distribution">Pareto</a> distribution.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
*/ */
public class ParetoDistr implements ContinuousDistribution { public class ParetoDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal Pareto pseudo random number generator. */
private final ParetoDistribution numGen; private final ParetoDistribution numGen;
/** /**
* Instantiates a new pareto distr. * Instantiates a new Pareto pseudo random number generator.
* *
* @param seed the seed * @param seed the seed
* @param shape the shape * @param shape the shape
...@@ -37,7 +38,7 @@ public class ParetoDistr implements ContinuousDistribution { ...@@ -37,7 +38,7 @@ public class ParetoDistr implements ContinuousDistribution {
} }
/** /**
* Instantiates a new pareto distr. * Instantiates a new Pareto pseudo random number generator.
* *
* @param shape the shape * @param shape the shape
* @param location the location * @param location the location
...@@ -46,10 +47,6 @@ public class ParetoDistr implements ContinuousDistribution { ...@@ -46,10 +47,6 @@ public class ParetoDistr implements ContinuousDistribution {
numGen = new ParetoDistribution(location, shape); numGen = new ParetoDistribution(location, shape);
} }
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override @Override
public double sample() { public double sample() {
return numGen.sample(); return numGen.sample();
......
...@@ -13,18 +13,20 @@ import java.util.Random; ...@@ -13,18 +13,20 @@ import java.util.Random;
import org.apache.commons.math3.distribution.UniformRealDistribution; import org.apache.commons.math3.distribution.UniformRealDistribution;
/** /**
* A random number generator based on the Uniform distribution. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)">
* Uniform continuous distribution</a>.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
*/ */
public class UniformDistr implements ContinuousDistribution { public class UniformDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal uniform pseudo random number generator. */
private final UniformRealDistribution numGen; private final UniformRealDistribution numGen;
/** /**
* Creates new uniform distribution. * Creates new uniform pseudo random number generator.
* *
* @param min minimum value * @param min minimum value
* @param max maximum value * @param max maximum value
...@@ -34,7 +36,7 @@ public class UniformDistr implements ContinuousDistribution { ...@@ -34,7 +36,7 @@ public class UniformDistr implements ContinuousDistribution {
} }
/** /**
* Creates new uniform distribution. * Creates new uniform pseudo random number generator.
* *
* @param min minimum value * @param min minimum value
* @param max maximum value * @param max maximum value
...@@ -45,18 +47,13 @@ public class UniformDistr implements ContinuousDistribution { ...@@ -45,18 +47,13 @@ public class UniformDistr implements ContinuousDistribution {
numGen.reseedRandomGenerator(seed); numGen.reseedRandomGenerator(seed);
} }
/**
* Generate a new random number.
*
* @return the next random number in the sequence
*/
@Override @Override
public double sample() { public double sample() {
return numGen.sample(); return numGen.sample();
} }
/** /**
* Generates a new random number based on the number generator and values provided as * Generates a new pseudo random number based on the generator and values provided as
* parameters. * parameters.
* *
* @param rd the random number generator * @param rd the random number generator
...@@ -73,7 +70,7 @@ public class UniformDistr implements ContinuousDistribution { ...@@ -73,7 +70,7 @@ public class UniformDistr implements ContinuousDistribution {
} }
/** /**
* Set the random number generator's seed. * Sets the random number generator's seed.
* *
* @param seed the new seed for the generator * @param seed the new seed for the generator
*/ */
......
...@@ -14,18 +14,19 @@ import java.util.Random; ...@@ -14,18 +14,19 @@ import java.util.Random;
import org.apache.commons.math3.distribution.WeibullDistribution; import org.apache.commons.math3.distribution.WeibullDistribution;
/** /**
* The Class WeibullDistr. * A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Weibull_distribution">Weibull distribution</a>.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
*/ */
public class WeibullDistr implements ContinuousDistribution { public class WeibullDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal Weibull pseudo random number generator. */
private final WeibullDistribution numGen; private final WeibullDistribution numGen;
/** /**
* Instantiates a new weibull distr. * Instantiates a new Weibull pseudo random number generator.
* *
* @param seed the seed * @param seed the seed
* @param alpha the alpha * @param alpha the alpha
...@@ -37,7 +38,7 @@ public class WeibullDistr implements ContinuousDistribution { ...@@ -37,7 +38,7 @@ public class WeibullDistr implements ContinuousDistribution {
} }
/** /**
* Instantiates a new weibull distr. * Instantiates a new Weibull pseudo random number generator.
* *
* @param alpha the alpha * @param alpha the alpha
* @param beta the beta * @param beta the beta
...@@ -46,10 +47,6 @@ public class WeibullDistr implements ContinuousDistribution { ...@@ -46,10 +47,6 @@ public class WeibullDistr implements ContinuousDistribution {
numGen = new WeibullDistribution(alpha, beta); numGen = new WeibullDistribution(alpha, beta);
} }
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override @Override
public double sample() { public double sample() {
return numGen.sample(); return numGen.sample();
......
...@@ -12,14 +12,15 @@ package org.cloudbus.cloudsim.distributions; ...@@ -12,14 +12,15 @@ package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class ZipfDistr. * A pseudo random number generator following the
* <a href="http://en.wikipedia.org/wiki/Zipf's_law">Zipf</a> distribution.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
*/ */
public class ZipfDistr implements ContinuousDistribution { public class ZipfDistr implements ContinuousDistribution {
/** The num gen. */ /** The internal random number generator. */
private final Random numGen; private final Random numGen;
/** The shape. */ /** The shape. */
...@@ -29,7 +30,7 @@ public class ZipfDistr implements ContinuousDistribution { ...@@ -29,7 +30,7 @@ public class ZipfDistr implements ContinuousDistribution {
private double den; private double den;
/** /**
* Instantiates a new zipf distr. * Instantiates a new Zipf pseudo random number generator.
* *
* @param seed the seed * @param seed the seed
* @param shape the shape * @param shape the shape
...@@ -46,7 +47,7 @@ public class ZipfDistr implements ContinuousDistribution { ...@@ -46,7 +47,7 @@ public class ZipfDistr implements ContinuousDistribution {
} }
/** /**
* Instantiates a new zipf distr. * Instantiates a new Zipf pseudo random number generator.
* *
* @param shape the shape * @param shape the shape
* @param population the population * @param population the population
...@@ -60,11 +61,6 @@ public class ZipfDistr implements ContinuousDistribution { ...@@ -60,11 +61,6 @@ public class ZipfDistr implements ContinuousDistribution {
computeDen(shape, population); computeDen(shape, population);
} }
/**
* Generate a new random number.
*
* @return the next random number in the sequence
*/
@Override @Override
public double sample() { public double sample() {
double variate = numGen.nextDouble(); double variate = numGen.nextDouble();
...@@ -82,7 +78,7 @@ public class ZipfDistr implements ContinuousDistribution { ...@@ -82,7 +78,7 @@ public class ZipfDistr implements ContinuousDistribution {
} }
/** /**
* Compute den. * Compute the den.
* *
* @param shape the shape * @param shape the shape
* @param population the population * @param population the population
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment