RNStreamIfc

Represents a random number stream with stream control

Author

rossetti

Inheritors

Properties

Link copied to clipboard
abstract val id: Int

An identifier assigned by the underlying stream factory to identity the stream for reporting purposes

Link copied to clipboard
open val streamNumber: Int?

If the stream has been provided by a RNStreamProvider, then its assigned stream number is returned.

Link copied to clipboard

If the stream has been provided by a RNStreamProvider, then this returns the reference to the provider.

Functions

Link copied to clipboard
open fun discreteInverseCDF(array: IntArray, cdf: DoubleArray): Int

Randomly selects from the array using the supplied cdf, NO checking of arrays

Link copied to clipboard
open fun <T> permute(x: Array<T>)
open fun permute(x: BooleanArray)

Randomly permutes the supplied array using the stream. The array is changed.

open fun permute(x: DoubleArray)

Randomly permutes the supplied array

open fun permute(x: IntArray)

Randomly permutes the supplied array, the array is changed.

open fun <T> permute(x: MutableList<T>)

Randomly permutes the supplied List using the stream. The list is changed.

Link copied to clipboard
open fun randInt(range: IntRange): Int

A convenience function for allowing the range to be specified via a range

open fun randInt(i: Int, j: Int): Int

Returns a (pseudo)random number from the discrete uniform distribution over the integers {i, i + 1, . . . , j }, using this stream. Calls randU01 once.

Link copied to clipboard
open fun randomlySelect(array: IntArray): Int

Randomly select an element from the array

open fun randomlySelect(array: IntArray, cdf: DoubleArray): Int

Randomly selects from the array using the supplied cdf

Link copied to clipboard
open fun rBernoulli(pSuccess: Double = 0.5): Double
Link copied to clipboard
open fun rBernoulliBoolean(pSuccess: Double = 0.5): Boolean
Link copied to clipboard
open fun rBeta(alpha: Double, beta: Double): Double

This beta is restricted to the range of (0,1)

Link copied to clipboard
open fun rBetaG(alpha: Double, beta: Double, minimum: Double, maximum: Double): Double

This beta is restricted to the range of (minimum,maximum)

Link copied to clipboard
open fun rBinomial(pSuccess: Double, nTrials: Int): Int
Link copied to clipboard
open fun rChiSquared(dof: Double): Double
Link copied to clipboard
open fun rDUniform(range: IntRange): Int
open fun rDUniform(minimum: Int, maximum: Int): Int

Generates a discrete uniform over the range

Link copied to clipboard
open fun rExponential(mean: Double): Double
Link copied to clipboard
open fun rGamma(shape: Double, scale: Double, type: KSLRandom.AlgoType = AlgoType.Inverse): Double
Link copied to clipboard
open fun rGeometric(pSuccess: Double): Int
Link copied to clipboard
open fun rJohnsonB(alpha1: Double, alpha2: Double, min: Double, max: Double): Double
Link copied to clipboard
open fun rLaplace(location: Double, scale: Double): Double

Generates according to a Laplace(location, scale)

Link copied to clipboard
open fun rLogistic(location: Double, scale: Double): Double
Link copied to clipboard
open fun rLogLogistic(shape: Double, scale: Double): Double
Link copied to clipboard
open fun rLogNormal(mean: Double, variance: Double): Double
Link copied to clipboard
open fun rNegBinomial(pSuccess: Double, rSuccesses: Double): Int
Link copied to clipboard
open fun rNormal(mean: Double = 0.0, variance: Double = 1.0): Double
Link copied to clipboard
open fun rPearsonType5(shape: Double, scale: Double): Double
Link copied to clipboard
open fun rPearsonType6(alpha1: Double, alpha2: Double, beta: Double): Double

Pearson Type 6

Link copied to clipboard
open fun rPoisson(mean: Double): Int
Link copied to clipboard
open fun rSign(pSuccess: Double = 0.5): Double

Returns a randomly generated sign -1 or +1

Link copied to clipboard
open fun rSignWithZero(): Double

Returns a randomly generated sign -1, 0, +1 all equally likely.

Link copied to clipboard
open fun rTriangular(min: Double, mode: Double, max: Double): Double
Link copied to clipboard
open fun rUniform(minimum: Double = 0.0, maximum: Double = 1.0): Double

Generates a continuous uniform over the range

Link copied to clipboard
open fun rWeibull(shape: Double, scale: Double): Double
Link copied to clipboard
open fun <T> sampleWithoutReplacement(x: Array<T>, sampleSize: Int)

The array x is changed, such that the first sampleSize elements contain the generated sample. That is, x0, x1, ... , xsampleSize-1 is the randomly sampled values without replacement

open fun sampleWithoutReplacement(x: BooleanArray, sampleSize: Int)
open fun sampleWithoutReplacement(x: IntArray, sampleSize: Int)

The array x is changed, such that the first sampleSize elements contain the generated sample. That is, x0, x1, ... , xsampleSize-1 is the random sample without replacement

open fun sampleWithoutReplacement(x: DoubleArray, sampleSize: Int)

The array x is changed, such that the first sampleSize elements contain the sample. That is, x0, x1, ... , xsampleSize-1 is the random sample without replacement

open fun <T> sampleWithoutReplacement(x: MutableList<T>, sampleSize: Int)

The List x is changed, such that the first sampleSize elements contain the sampled values. That is, x.get(0), x.get(1), ... , x.get(sampleSize-1) is the random sample without replacement