scalation

random

package random

The random package contains classes, traits and objects for the generation of random numbers.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. random
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class Bernoulli(p: Double = .5, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Bernoulli random variates.

    This class generates Bernoulli random variates. This discrete RV models the one trial (success is 1, failure is 0).

    p

    the probability of success

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/bernoulli/Introduction.html

  2. case class Beta(alpha: Double = 2, beta: Double = 3, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Beta random variates.

    This class generates Beta random variates. This continuous RV models random proportions. Beta = Gamma1 / (Gamma1 + Gamma2).

    alpha

    the shape parameter for Gamma1

    beta

    the shape parameter for Gamma2

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Beta.html

  3. case class Binomial(p: Double = .5, n: Int = 10, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Binomial random variates.

    This class generates Binomial random variates. This discrete RV models the number of successes in n trials.

    p

    the probability of success

    n

    the number of independent trials

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/bernoulli/Binomial.html

  4. case class Cauchy(alpha: Double = 2.5, beta: Double = 1.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Cauchy (or Lorentz) random variates.

    This class generates Cauchy (or Lorentz) random variates. This continuous RV models data with heavier tails than normally distributed.

    alpha

    the location parameter (median)

    beta

    the scale parameter

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Cauchy.html

  5. case class ChiSquare(df: Int = 2, stream: Int = 0) extends Variate with Product with Serializable

    This class generates ChiSquare random variates.

    This class generates ChiSquare random variates. This continuous RV models the variance of a distribution. http://www.math.uah.edu/stat/special/ChiSquare.html

    df

    the degrees of freedom

    stream

    the random number stream

  6. case class Dice(cdf: Array[Double] = Array (.1, .3, .5, .7, .9, 1.0), stream: Int = 0) extends Variate with Product with Serializable

    This class generates Dice random variates for a given distribution specified using a cumulative distribution function (cdf).

    This class generates Dice random variates for a given distribution specified using a cumulative distribution function (cdf). This discrete RV models the roll of dice numbered 0, 1, ..., n-1. Add 1 for 1 to n.

    cdf

    the distribution function (cdf)

    stream

    the random number stream

  7. case class Discrete(dist: VectorD = VectorD (.2, .2, .2, .2, .2), x: VectorD = null, cumulative: Boolean = false, stream: Int = 0) extends Variate with Product with Serializable

    This class generates generalized Discrete random variates for a given distribution specified using either a probability mass function (pmf) or a cumulative distribution function (cdf).

    This class generates generalized Discrete random variates for a given distribution specified using either a probability mass function (pmf) or a cumulative distribution function (cdf). This discrete RV models arbitrary experiments with discrete outcomes.

    dist

    the distribution function (pdf or cdf)

    x

    the x-coordinate values (mass points)

    cumulative

    whether dist is cumulative (cdf) or not (pmf)

    stream

    the random number stream

  8. case class Erlang(mu: Double = 1.0, k: Int = 2, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Erlang random variates.

    This class generates Erlang random variates. This continuous RV models the time until k stages complete.

    mu

    the mean of exponential samples (Erlang mean = mu * k)

    k

    the number of stages (or Exponential samples)

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/poisson/Gamma.html

  9. case class Exponential(mu: Double = 1.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Exponential random variates.

    This class generates Exponential random variates. This continuous RV models the time until an event occurs. http://www.math.uah.edu/stat/poisson/Exponential.html

    mu

    the mean

    stream

    the random number stream

  10. case class Fisher(df1: Int = 6, df2: Int = 4, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Fisher (F-Distribution) random variates.

    This class generates Fisher (F-Distribution) random variates. This continuous RV models the ratio of variances.

    df1

    the degrees of freedom for numerator Chi-Square

    df2

    the degrees of freedom for denominator Chi-Square

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Fisher.html

  11. case class Gamma(alpha: Double = 1.0, beta: Double = 1.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Gamma random variates.

    This class generates Gamma random variates. This continuous RV models the time until an event occurs. Note: variance = alpha * beta ^ 2.

    alpha

    the shape parameter

    beta

    the scale parameter

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/poisson/Gamma.html

  12. case class Geometric(p: Double = .5, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Geometric random variates.

    This class generates Geometric random variates. This discrete RV models the number of failures before the first success.

    p

    the probability of success

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/bernoulli/Geometric.html

  13. case class HyperExponential(p: Double = .5, mu1: Double = 1, mu2: Double = 2, stream: Int = 0) extends Variate with Product with Serializable

    This class generates HyperExponential random variates (two rates).

    This class generates HyperExponential random variates (two rates). This continuous RV models the time until an event occurs (higher coefficient of variation than exponential distribution).

    p

    the probability of first vs. second rates

    mu1

    the first mean (1 / lambda1)

    mu2

    the second mean (1 / lambda2)

    stream

    the random number stream

  14. case class HyperGeometric(p: Double = .5, n: Int = 5, pop: Int = 10, stream: Int = 0) extends Variate with Product with Serializable

    This class generates HyperGeometric random variates.

    This class generates HyperGeometric random variates. This discrete RV models the number of successes in n draws from a finite population.

    p

    the probability of success (red balls)

    n

    the number of draws (balls drawn)

    pop

    the size of the finite population (total number of balls)

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/urn/Hypergeometric.html

  15. case class LogNormal(mu: Double = 0.0, sigma2: Double = 1.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates LogNormal random variates.

    This class generates LogNormal random variates. This continuous RV models data that is normally distributed after a log transformation.

    mu

    the mean for underlying Normal

    sigma2

    the variance (sigma squared) for underlying Normal

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/LogNormal.html

  16. case class Logistic(a: Double = 0.0, b: Double = 1.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Logistic random variates.

    This class generates Logistic random variates. This continuous RV models logisticlly distributed data (stretched Normal).

    a

    the location parameter

    b

    the scale parameter

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Logistic.html

  17. case class Multinomial(p: Array[Double] = Array (.4, .3, .3), n: Int = 5, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Multinomial random variates vectors.

    This class generates Multinomial random variates vectors. This discrete RV models the ...?

    p

    array of probabilities

    n

    the number of independent trials

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/bernoulli/Multinomial.html

  18. case class NHPoissonProcess(lambda: VectorD, dt: Double = 1.0, stream: Int = 0) extends TimeVariate with Product with Serializable

    This class generates arrival times according to a NHPoissonProces, an Non-Homogeneous Process Process (NHPP), where the arrival rate function 'lambda(t)' is piecewise constant.

    This class generates arrival times according to a NHPoissonProces, an Non-Homogeneous Process Process (NHPP), where the arrival rate function 'lambda(t)' is piecewise constant. Rates are constant over basic time intervals of length 'dt'.

    lambda

    the vector of arrival rates

    dt

    the length the basic time intervals

    stream

    the random number stream

    See also

    http://en.wikipedia.org/wiki/Poisson_process#Non-homogeneous

  19. case class NegativeBinomial(p: Double = .5, s: Int = 2, stream: Int = 0) extends Variate with Product with Serializable

    This class generates NegativeBinomial random variates.

    This class generates NegativeBinomial random variates. This discrete RV models the number of failures before s-th success.

    p

    the probability of success

    s

    the number of successes

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/bernoulli/NegativeBinomial.html

  20. case class Normal(mu: Double = 0.0, sigma2: Double = 1.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Normal (Gaussian) random variates.

    This class generates Normal (Gaussian) random variates. This continuous RV models normally distributed data (bell curve). When summed, most distributions tend to Normal (Central Limit Theorem).

    mu

    the mean

    sigma2

    the variance (sigma squared)

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Normal.html

  21. case class NormalVec(mu: VectorD, cov: MatrixD, stream: Int = 0) extends VariateVec with Product with Serializable

    The NormalVec class generates Normal (Gaussian) random variate vectors according to the Multivariate Normal distribution with mean 'mu' and covariance 'cov'.

    The NormalVec class generates Normal (Gaussian) random variate vectors according to the Multivariate Normal distribution with mean 'mu' and covariance 'cov'. This continuous RVV models normally distributed multidimensional data.

    mu

    the mean vector

    cov

    the covariance matrix

    stream

    the random number stream

    See also

    http://www.statlect.com/mcdnrm1.htm

    http://onlinelibrary.wiley.com/doi/10.1111/1467-9639.00037/pdf

  22. case class Pareto(a: Double = 1.0, b: Double = 0.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Pareto random variates.

    This class generates Pareto random variates. This continuous RV models Pareto distributed data.

    a

    the shape parameter

    b

    the scale parameter

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Pareto.html

  23. case class PermutedVecD(x: VectorD, stream: Int = 0) extends VariateVec with Product with Serializable

    The PermutedVecD class generates random permutations of a vector of doubles.

    The PermutedVecD class generates random permutations of a vector of doubles.

    x

    the vector of doubles to permute

    stream

    the random number stream

    See also

    maths-people.anu.edu.au/~brent/pd/Arndt-thesis.pdf

  24. case class PermutedVecI(x: VectorI, stream: Int = 0) extends VariateVec with Product with Serializable

    The PermutedVecI class generates random permutations of a vector of integers.

    The PermutedVecI class generates random permutations of a vector of integers.

    x

    the vector of integers to permute

    stream

    the random number stream

    See also

    maths-people.anu.edu.au/~brent/pd/Arndt-thesis.pdf

  25. case class Poisson(mu: Double = 2.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Poisson random variates (discrete).

    This class generates Poisson random variates (discrete). This discrete RV models the number of events in a time interval of unit length.

    mu

    the mean

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/poisson/Poisson.html

  26. case class PoissonProcess(lambda: Double, stream: Int = 0) extends TimeVariate with Product with Serializable

    This class generates arrival times according to a PoissonProcess.

    This class generates arrival times according to a PoissonProcess. Given the current arrival time 't', generate the next arrival time.

    lambda

    the arrival rate (arrivals per unit time)

    stream

    the random number stream

    See also

    http://en.wikipedia.org/wiki/Poisson_process

  27. case class ProbabilityVec(n: Int, d: Double = 0.5, stream: Int = 0) extends VariateVec with Product with Serializable

    The ProbabilityVec class generates a probability vector where the ith probability is '1/n' with a +/- randomizing displacement of at most 'd'.

    The ProbabilityVec class generates a probability vector where the ith probability is '1/n' with a +/- randomizing displacement of at most 'd'. Note, the probability vector must add to one.

    n

    the dimension/size of the probability vector

    d

    the randomizing displacement, must be in [0, 1]

  28. abstract class RNG extends Error

    The RNG abstract class is the base class for all ScalaTion Random Number Generators (RNGs).

    The RNG abstract class is the base class for all ScalaTion Random Number Generators (RNGs). The subclasses must implement a 'gen' method that generates random real numbers in the range (0, 1). They must also implement an 'igen' methods to return stream values.

  29. case class Randi(a: Int = 0, b: Int = 5, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Randi random variates (random integers: a, ..., b).

    This class generates Randi random variates (random integers: a, ..., b). This discrete RV models equiprobable integral outcomes.

    a

    the lower bound (inclusive)

    b

    the upper bound (inclusive)

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/UniformDiscrete.html

  30. case class Randi0(b: Int = 5, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Randi0 random variates (random integers: 0, ..., b).

    This class generates Randi0 random variates (random integers: 0, ..., b). This discrete RV models equiprobable integral outcomes starting with 0.

    b

    the upper bound (>= 0) (inclusive)

    stream

    the random number stream

  31. case class Random(stream: Int = 0) extends RNG with Product with Serializable

    The Random class generates random real numbers in the range (0, 1).

    The Random class generates random real numbers in the range (0, 1). It implements, using 64-bit integers (Long's), the 'MRG31k3p' generator developed by L'Ecuyer and Touzin, described in "FAST COMBINED MULTIPLE RECURSIVE GENERATORS WITH MULTIPLIERS OF THE FORM a = 2q +/- 2r". MRG31k3p is a Combined Multiple Recursive Generator (CMRG) shown to have good performance and statistical properties for simulations. It has a period of about 2185 and is considered to be a faster alternative to the popular 'MRG32k3' generator. MRG31k3p combines MRG1 and MRG2.
    MRG1: x_i = (0 + a_12 x_i-2 + a_13 x_i-3) % M1 MRG2: x_i = (a_21 x_i-1 + 0 + a_23 x_i-3) % M2
    where a_12 = 2
    22, a_13 = 27+1, a_21 = 215 and a_23 = 2^15+1.

    stream

    the random number stream index

    See also

    http://www.iro.umontreal.ca/~simardr/ssj/doc/pdf/guiderng.pdf

    http://www.informs-sim.org/wsc00papers/090.PDF

  32. case class Random2(stream: Int = 0) extends RNG with Product with Serializable

    The Random2 class generates random real numbers in the range (0, 1).

    The Random2 class generates random real numbers in the range (0, 1). It implements, using 32-bit integers (Int's), the 'MRG31k3p' generator developed by L'Ecuyer and Touzin, described in "FAST COMBINED MULTIPLE RECURSIVE GENERATORS WITH MULTIPLIERS OF THE FORM a = 2q +/- 2r". MRG31k3p is a Combined Multiple Recursive Generator (CMRG) shown to have good performance and statistical properties for simulations. It has a period of about 2185 and is considered to be a faster alternative to the popular 'MRG32k3' generator. MRG31k3p combines MRG1 and MRG2.
    MRG1: x_i = (0 + a_12 x_i-2 + a_13 x_i-3) % M1 MRG2: x_i = (a_21 x_i-1 + 0 + a_23 x_i-3) % M2
    where a_12 = 2
    22, a_13 = 27+1, a_21 = 215 and a_23 = 2^15+1.

    stream

    the random number stream index

    See also

    http://www.iro.umontreal.ca/~simardr/ssj/doc/pdf/guiderng.pdf

    http://www.informs-sim.org/wsc00papers/090.PDF

  33. case class Random3(stream: Int = 0) extends RNG with Product with Serializable

    The Random3 class generates random real numbers in the range (0, 1).

    The Random3 class generates random real numbers in the range (0, 1). It implements, using 64-bit integers (Int's), the 'MINSTD' generator, which is a multiplicative Linear Congruential Generator (LCG). These generators were commonly used in the last century.
    x_i = a x_i-1 % m

    stream

    the random number stream index

    See also

    http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.1024

    Random

    http://random.mat.sbg.ac.at/results/karl/server/node4.html#SECTION00042000000000000000 In case a better generator is needed, a Multiple Recursive Generator (MRG) or Composite Multiple Recursive Generator (CMRG) should be used.

  34. case class Sharp(x: Double = 1, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Sharp (Deterministic) random variates.

    This class generates Sharp (Deterministic) random variates. This discrete RV models the case when the variance is 0.

    x

    the value for this constant distribution

    stream

    the random number stream

  35. case class StudentT(df: Int = 4, stream: Int = 0) extends Variate with Product with Serializable

    This class generates StudentT random variates.

    This class generates StudentT random variates. This continuous RV models cases where data are normally distributed, but variability increases since the variance is unknown.

    df

    the degrees of freedom

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Student.html

  36. abstract class TimeVariate extends Variate

    The TimeVariate abstract class serves as a superclass for time-based random variates such Poisson Processes.

  37. case class Trapezoidal(a: Double = 0.0, c: Double = 2.0, d: Double = 7.0, b: Double = 10.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Trapezoidal random variates.

    This class generates Trapezoidal random variates. This continuous RV models cases where outcomes cluster between two modes. Both Uniform and Triangular are special cases of Trapezoidal.

    a

    the minimum

    c

    the first mode

    d

    the second mode

    b

    the maximum

    stream

    the random number stream

    See also

    http://iopscience.iop.org/0026-1394/44/2/003/pdf/0026-1394_44_2_003.pdf

  38. case class Triangular(a: Double = 0, b: Double = 5, c: Double = Double.MaxValue, stream: Int = 0) extends Variate with Product with Serializable

    This class generates simple Triangular random variates with the mode in the middle.

    This class generates simple Triangular random variates with the mode in the middle. This continuous RV models cases where outcomes cluster around the mode.

    a

    the lower bound

    b

    the upper bound

    c

    the mode

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Triangle.html

  39. case class Trinomial(p: Double = 1.0/3.0, q: Double = 1.0/3.0, n: Int = 10, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Trinomial random variates.

    This class generates Trinomial random variates. While Binomial is based on trials with two outcomes, success (1) or failure (0). Trinomial is based on trials with three outcomes, high (2), medium (1) or low (0). This discrete RV models the result of 'n' trials.

    p

    the probability of high (2)

    q

    the probability of medium (1)

    n

    the number of independent trials

    stream

    the random number stream

    See also

    https://onlinecourses.science.psu.edu/stat414/node/106

  40. case class Uniform(a: Double = 0.0, b: Double = 5.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Uniform random variates in the range (a, b).

    This class generates Uniform random variates in the range (a, b). This continuous RV models equiprobable outcomes.

    a

    the lower bound

    b

    the upper bound

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/UniformContinuous.html

  41. abstract class Variate extends Error

    The Variate abstract class serves as a base class for all the random variate (RV) generators.

    The Variate abstract class serves as a base class for all the random variate (RV) generators. They use one of the Random Number Generators (RNG's) from Random to generate numbers following their particular distribution. Random Variate Generators (RVG's) for thirty popular probability distributions are implemented as extensions of Variate. Still need to add one.

    See also

    VariateVec for Random MultiVariate Generators (RMVG's).

    http://www.math.uah.edu/stat/special/index.html

  42. abstract class VariateVec extends Error

    The VariateVec abstract class serves as a base class for all the random variate vector (RVV) generators.

    The VariateVec abstract class serves as a base class for all the random variate vector (RVV) generators. They use one of the Random Number Generators (RNG's) from Random.scala to generate numbers following their particular multivariate distribution.

  43. case class Weibull(alpha: Double = 2.0, beta: Double = 2.0, stream: Int = 0) extends Variate with Product with Serializable

    This class generates Weibull random variates.

    This class generates Weibull random variates. This continuous RV models the time for an event to occur.

    alpha

    the shape parameter

    beta

    the scale parameter

    stream

    the random number stream

    See also

    http://www.math.uah.edu/stat/special/Weibull.html

  44. case class _HyperExponential(mu: Double = 1.0, sigma: Double = 2, stream: Int = 0) extends Variate with Product with Serializable

    This class generates HyperExponential random variates.

    This class generates HyperExponential random variates. This continuous RV models the time until an event occurs (higher coefficient of variation than exponential distribution). FIX

    mu

    the mean

    sigma

    the standard deviation

    stream

    the random number stream

Value Members

  1. object PoissonProcessTest extends App

    The PoissonProcessTest object is used to test both the PoissonProcess and NHPoissonProcess classes.

  2. object Quantile extends Error

    The Quantile object contains methods for computing 'Finv', the inverse Cumulative Distribution Functions (iCDF's) for popular sampling distributions: StandardNormal, StudentT, ChiSquare and Fisher.

    The Quantile object contains methods for computing 'Finv', the inverse Cumulative Distribution Functions (iCDF's) for popular sampling distributions: StandardNormal, StudentT, ChiSquare and Fisher. For a given CDF 'F' and quantile 'p', compute 'x' such that the 'F(x) = p'.

  3. object QuantileTest extends App

    The QuantileTest object tests the Quantile object.

  4. object RNGTest extends App with Error

    The RNGTest object conducts three simple tests of the Random Number Generators: (1) Spped Test, (2) Means Test and (3) Chi-square Goodness of Fit Test.

    The RNGTest object conducts three simple tests of the Random Number Generators: (1) Spped Test, (2) Means Test and (3) Chi-square Goodness of Fit Test. FIX: need to add (3) Variance Test and (4) K-S Goodness of Fit Test.

  5. object RandomSeeds

    The first 1000 seeds for the 'MRG31k3p' random number generator.

  6. object RandomSeeds3

    The first 1000 seeds for the LCG random number generator.

  7. object StreamMaker

    The StreamMaker object computes seeds for Random and Random2, both of which implement the 'MRG31k3p' random number generator.

    The StreamMaker object computes seeds for Random and Random2, both of which implement the 'MRG31k3p' random number generator. This generator has a period length around 2^185. Each seed is a 6-dimensional vector of 32-bit integers.

    See also

    http://www.iro.umontreal.ca/~simardr/ssj/indexe.html

  8. object StreamMaker3 extends App

    The StreamMaker3 object finds seeds for the Random3 random number generator.

    The StreamMaker3 object finds seeds for the Random3 random number generator. This generator has a period length around 2^31. Each seed is a 32-bit integer.

  9. object StreamMakerGen extends App

    The StreamMakerGen object generates and prints the first 'k' seeds for the the 'MRG31k3p' random number generator's streams.

  10. object VariateTest extends App

    The VariateTest object conducts two simple tests of the Random Variate Generators: (1) Means Test and (2) Chi-square Goodness of Fit Test.

    The VariateTest object conducts two simple tests of the Random Variate Generators: (1) Means Test and (2) Chi-square Goodness of Fit Test. FIX: need to add (3) Variance Test and (4) K-S Goodness of Fit Test.

  11. object VariateVecTest extends App

    The VariateVecTest object is used to test the Random Variate Vector (RVV) generators from the classes derived from VariateVec.

Inherited from AnyRef

Inherited from Any

Ungrouped