kotlin-numpy / org.jetbrains.numkt.random / Random

Random

class Random (source)

Constructors

<init>

Random()

Companion Object Functions

beta

Draw samples from a Beta distribution.

fun beta(a: Double, b: Double): Doublefun beta(a: DoubleArray, b: Double): KtNDArray<Double>
fun beta(a: Double, b: DoubleArray): KtNDArray<Double>
fun beta(a: DoubleArray, b: DoubleArray): KtNDArray<Double>
fun beta(a: Double, b: Double, vararg size: Int): KtNDArray<Double>
fun beta(a: DoubleArray, b: Double, vararg size: Int): KtNDArray<Double>
fun beta(a: Double, b: DoubleArray, vararg size: Int): KtNDArray<Double>
fun beta(a: DoubleArray, b: DoubleArray, vararg size: Int): KtNDArray<Double>

binomial

Draw samples from a binomial distribution.

fun binomial(n: Int, p: Double): Longfun binomial(n: IntArray, p: Double): KtNDArray<Long>
fun binomial(n: Int, p: DoubleArray): KtNDArray<Long>
fun binomial(n: IntArray, p: DoubleArray): KtNDArray<Long>
fun binomial(n: Int, p: Double, vararg size: Int): KtNDArray<Long>
fun binomial(n: IntArray, p: Double, vararg size: Int): KtNDArray<Long>
fun binomial(n: Int, p: DoubleArray, vararg size: Int): KtNDArray<Long>
fun binomial(n: IntArray, p: DoubleArray, vararg size: Int): KtNDArray<Long>

bytes

Return random bytes.

fun bytes(length: Int): ByteArray

chisquare

Draw samples from a chi-square distribution.

fun chisquare(df: Double): Doublefun chisquare(df: DoubleArray): KtNDArray<Double>
fun chisquare(df: Double, vararg size: Int): KtNDArray<Double>
fun chisquare(df: DoubleArray, vararg size: Int): KtNDArray<Double>

choice

Generates a random sample from a given 1-D array

fun choice(a: Int, replace: Boolean = true): Longfun choice(a: Int, vararg size: Int, replace: Boolean = true, p: DoubleArray? = null): KtNDArray<Long>

dirichlet

Draw samples from the Dirichlet distribution.

fun <T : Number> dirichlet(alpha: Array<T>, vararg size: Int? = emptyArray()): KtNDArray<Double>

exponential

Draw samples from an exponential distribution.

fun exponential(scale: Double = 1.0): Doublefun exponential(scale: Double = 1.0, vararg size: Int): KtNDArray<Double>

f

Draw samples from an F distribution.

fun f(dfnum: Double, dfden: Double): Doublefun f(dfnum: DoubleArray, dfden: Double): KtNDArray<Double>
fun f(dfnum: Double, dfden: DoubleArray): KtNDArray<Double>
fun f(dfnum: DoubleArray, dfden: DoubleArray): KtNDArray<Double>
fun f(dfnum: Double, dfden: Double, vararg size: Int): KtNDArray<Double>
fun f(dfnum: DoubleArray, dfden: Double, vararg size: Int): KtNDArray<Double>
fun f(dfnum: Double, dfden: DoubleArray, vararg size: Int): KtNDArray<Double>
fun f(dfnum: DoubleArray, dfden: DoubleArray, vararg size: Int): KtNDArray<Double>

gamma

Draw samples from a Gamma distribution.

fun gamma(shape: Double, scale: Double = 1.0): Doublefun gamma(shape: DoubleArray, scale: Double = 1.0): KtNDArray<Double>
fun gamma(shape: Double, scale: DoubleArray): KtNDArray<Double>
fun gamma(shape: DoubleArray, scale: DoubleArray): KtNDArray<Double>
fun gamma(shape: Double, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun gamma(shape: DoubleArray, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun gamma(shape: Double, scale: DoubleArray, vararg size: Int): KtNDArray<Double>
fun gamma(shape: DoubleArray, scale: DoubleArray, vararg size: Int): KtNDArray<Double>

geometric

Draw samples from the geometric distribution.

fun geometric(p: Double): Longfun geometric(p: DoubleArray): KtNDArray<Long>
fun geometric(p: Double, vararg size: Int): KtNDArray<Long>
fun geometric(p: DoubleArray, vararg size: Int): KtNDArray<Long>

gumbel

Draw samples from a Gumbel distribution.

fun gumbel(loc: Double = 0.0, scale: Double = 1.0): Doublefun gumbel(loc: DoubleArray, scale: Double = 1.0): KtNDArray<Double>
fun gumbel(loc: Double = 0.0, scale: DoubleArray): KtNDArray<Double>
fun gumbel(loc: DoubleArray, scale: DoubleArray): KtNDArray<Double>
fun gumbel(loc: Double = 0.0, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun gumbel(loc: DoubleArray, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun gumbel(loc: Double = 0.0, scale: DoubleArray, vararg size: Int): KtNDArray<Double>
fun gumbel(loc: DoubleArray, scale: DoubleArray, vararg size: Int): KtNDArray<Double>

hypergeometric

Draw samples from a Hypergeometric distribution.

fun hypergeometric(ngood: Int, nbad: Int, nsample: Int): Doublefun hypergeometric(ngood: IntArray, nbad: Int, nsample: Int): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: IntArray, nsample: Int): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: Int, nsample: IntArray): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: IntArray, nsample: Int): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: IntArray, nsample: IntArray): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: Int, nsample: IntArray): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: IntArray, nsample: IntArray): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: Int, nsample: Int, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: Int, nsample: Int, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: IntArray, nsample: Int, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: Int, nsample: IntArray, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: IntArray, nsample: Int, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: Int, nbad: IntArray, nsample: IntArray, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: Int, nsample: IntArray, vararg size: Int): KtNDArray<Double>
fun hypergeometric(ngood: IntArray, nbad: IntArray, nsample: IntArray, vararg size: Int): KtNDArray<Double>

laplace

Draw samples from the Laplace or double exponential distribution with specified location (or mean) and scale (decay).

fun laplace(loc: Double = 0.0, scale: Double = 1.0): Doublefun laplace(loc: DoubleArray, scale: Double = 1.0): KtNDArray<Double>
fun laplace(loc: Double = 0.0, scale: DoubleArray): KtNDArray<Double>
fun laplace(loc: DoubleArray, scale: DoubleArray): KtNDArray<Double>
fun laplace(loc: Double = 0.0, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun laplace(loc: DoubleArray, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun laplace(loc: Double = 0.0, scale: DoubleArray, vararg size: Int): KtNDArray<Double>
fun laplace(loc: DoubleArray, scale: DoubleArray, vararg size: Int): KtNDArray<Double>

logistic

Draw samples from a logistic distribution.

fun logistic(loc: Double = 0.0, scale: Double = 1.0): Doublefun logistic(loc: DoubleArray, scale: Double = 1.0): KtNDArray<Double>
fun logistic(loc: Double = 0.0, scale: DoubleArray): KtNDArray<Double>
fun logistic(loc: DoubleArray, scale: DoubleArray): KtNDArray<Double>
fun logistic(loc: Double = 0.0, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun logistic(loc: DoubleArray, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun logistic(loc: Double = 0.0, scale: DoubleArray, vararg size: Int): KtNDArray<Double>
fun logistic(loc: DoubleArray, scale: DoubleArray, vararg size: Int): KtNDArray<Double>

lognormal

Draw samples from a log-normal distribution.

fun lognormal(mean: Double = 0.0, sigma: Double = 1.0): Doublefun lognormal(mean: DoubleArray, sigma: Double = 1.0): KtNDArray<Double>
fun lognormal(mean: Double = 0.0, sigma: DoubleArray): KtNDArray<Double>
fun lognormal(mean: DoubleArray, sigma: DoubleArray): KtNDArray<Double>
fun lognormal(mean: Double = 0.0, sigma: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun lognormal(mean: DoubleArray, sigma: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun lognormal(mean: Double = 0.0, sigma: DoubleArray, vararg size: Int): KtNDArray<Double>
fun lognormal(mean: DoubleArray, sigma: DoubleArray, vararg size: Int): KtNDArray<Double>

logseries

Draw samples from a logarithmic series distribution.

fun logseries(p: Double): Longfun logseries(p: DoubleArray): KtNDArray<Long>
fun logseries(p: Double, vararg size: Int): KtNDArray<Long>
fun logseries(p: DoubleArray, vararg size: Int): KtNDArray<Long>

multinomial

Draw samples from a multinomial distribution.

fun multinomial(n: Int, pvals: DoubleArray, vararg size: Int? = emptyArray()): KtNDArray<Long>

multivariateNormal

Draw random samples from a multivariate normal distribution.

fun <T : Number, E : Number> multivariateNormal(mean: KtNDArray<T>, cov: KtNDArray<E>, size: IntArray? = null, checkValid: String? = null, tol: Double? = null): KtNDArray<Double>

negativeBinomial

Draw samples from a negative binomial distribution.

fun negativeBinomial(n: Int, p: Double): Longfun negativeBinomial(n: IntArray, p: Double): KtNDArray<Long>
fun negativeBinomial(n: Int, p: DoubleArray): KtNDArray<Long>
fun negativeBinomial(n: IntArray, p: DoubleArray): KtNDArray<Long>
fun negativeBinomial(n: Int, p: Double, vararg size: Int): KtNDArray<Long>
fun negativeBinomial(n: IntArray, p: Double, vararg size: Int): KtNDArray<Long>
fun negativeBinomial(n: Int, p: DoubleArray, vararg size: Int): KtNDArray<Long>
fun negativeBinomial(n: IntArray, p: DoubleArray, vararg size: Int): KtNDArray<Long>

noncentralChisquare

Draw samples from a noncentral chi-square distribution.

fun noncentralChisquare(df: Double, nonc: Double): Doublefun noncentralChisquare(df: DoubleArray, nonc: Double): KtNDArray<Double>
fun noncentralChisquare(df: Double, nonc: DoubleArray): KtNDArray<Double>
fun noncentralChisquare(df: DoubleArray, nonc: DoubleArray): KtNDArray<Double>
fun noncentralChisquare(df: Double, nonc: Double, vararg size: Int): KtNDArray<Double>
fun noncentralChisquare(df: DoubleArray, nonc: Double, vararg size: Int): KtNDArray<Double>
fun noncentralChisquare(df: Double, nonc: DoubleArray, vararg size: Int): KtNDArray<Double>
fun noncentralChisquare(df: DoubleArray, nonc: DoubleArray, vararg size: Int): KtNDArray<Double>

noncentralF

Draw samples from the noncentral F distribution.

fun noncentralF(dfnum: Double, dfden: Double, nonc: Double): Doublefun noncentralF(dfnum: DoubleArray, dfden: Double, nonc: Double): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: DoubleArray, nonc: Double): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: Double, nonc: DoubleArray): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: DoubleArray, nonc: Double): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: DoubleArray, nonc: DoubleArray): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: Double, nonc: DoubleArray): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: DoubleArray, nonc: DoubleArray): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: Double, nonc: Double, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: Double, nonc: Double, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: DoubleArray, nonc: Double, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: Double, nonc: DoubleArray, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: DoubleArray, nonc: Double, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: Double, dfden: DoubleArray, nonc: DoubleArray, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: Double, nonc: DoubleArray, vararg size: Int): KtNDArray<Double>
fun noncentralF(dfnum: DoubleArray, dfden: DoubleArray, nonc: DoubleArray, vararg size: Int): KtNDArray<Double>

normal

Draw random samples from a normal (Gaussian) distribution.

fun normal(loc: Double = 0.0, scale: Double = 1.0): Doublefun normal(loc: DoubleArray, scale: Double = 0.0): KtNDArray<Double>
fun normal(loc: Double = 0.0, scale: DoubleArray): KtNDArray<Double>
fun normal(loc: DoubleArray, scale: DoubleArray): KtNDArray<Double>
fun normal(loc: Double = 0.0, scale: Double = 1.0, size: Int): KtNDArray<Double>
fun normal(loc: Double = 0.0, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun normal(loc: DoubleArray, scale: Double = 1.0, size: Int): KtNDArray<Double>
fun normal(loc: DoubleArray, scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun normal(loc: Double = 0.0, scale: DoubleArray, size: Int): KtNDArray<Double>
fun normal(loc: Double = 0.0, scale: DoubleArray, vararg size: Int): KtNDArray<Double>
fun normal(loc: DoubleArray, scale: DoubleArray, size: Int): KtNDArray<Double>
fun normal(loc: DoubleArray, scale: DoubleArray, vararg size: Int): KtNDArray<Double>

pareto

Draw samples from a Pareto II or Lomax distribution with specified shape.

fun pareto(a: Double): Doublefun pareto(a: DoubleArray): KtNDArray<Double>
fun pareto(a: Double, vararg size: Int): KtNDArray<Double>
fun pareto(a: DoubleArray, vararg size: Int): KtNDArray<Double>

permutation

Randomly permute a sequence, or return a permuted range.

fun permutation(x: Int): KtNDArray<Long>fun permutation(x: Long): KtNDArray<Long>
fun permutation(x: IntArray): KtNDArray<Long>
fun <T : Number> permutation(x: KtNDArray<T>): KtNDArray<T>

poisson

Draw samples from a Poisson distribution.

fun poisson(lam: Double = 1.0): Doublefun poisson(lam: DoubleArray): KtNDArray<Double>
fun poisson(lam: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun poisson(lam: DoubleArray, vararg size: Int): KtNDArray<Double>

power

Draws samples in [0, 1] from a power distribution with positive exponent a - 1.

fun power(a: Double): Doublefun power(a: DoubleArray): KtNDArray<Double>
fun power(a: Double, vararg size: Int): KtNDArray<Double>
fun power(a: DoubleArray, vararg size: Int): KtNDArray<Double>

rand

Random values in a given shape. Defaults scalar.

fun rand(): Double

Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1)

fun rand(vararg d: Int): KtNDArray<Double>

randint

Return random integers from low (inclusive) to high (exclusive).

fun <T : Number> randint(low: Int, high: Int? = null): Tfun <T : Number> randint(low: Int, high: Int? = null, vararg size: Int): KtNDArray<T>

randn

Return a sample (or samples) from the “standard normal” distribution. Defaults scalar.

fun randn(): Doublefun randn(vararg d: Int): KtNDArray<Double>

random

Return random floats in the half-open interval [0.0, 1.0). Defaults scalar.

fun random(): Doublefun random(vararg size: Int): KtNDArray<Double>

randomIntegers

Random integers of type Long between low and high, inclusive.

fun randomIntegers(low: Int, high: Int? = null): Longfun randomIntegers(low: Int, high: Int? = null, vararg size: Int): KtNDArray<Long>

randomSample

Return random floats in the half-open interval [0.0, 1.0).

fun randomSample(): Doublefun randomSample(vararg size: Int): KtNDArray<Double>

ranf

Return random floats in the half-open interval [0.0, 1.0). Defaults scalar.

fun ranf(): Doublefun ranf(vararg size: Int): KtNDArray<Double>

rayleigh

Draw samples from a Rayleigh distribution.

fun rayleigh(scale: Double = 1.0): Doublefun rayleigh(scale: DoubleArray): KtNDArray<Double>
fun rayleigh(scale: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun rayleigh(scale: DoubleArray, vararg size: Int): KtNDArray<Double>

sample

Return random floats in the half-open interval [0.0, 1.0).

fun sample(): Doublefun sample(vararg size: Int): KtNDArray<Double>

shuffle

Modify a sequence in-place by shuffling its contents.

fun <T : Any> shuffle(x: KtNDArray<T>): Unit

standardExponential

Draw samples from the standard exponential distribution.

fun standardExponential(): Doublefun standardExponential(vararg size: Int): KtNDArray<Double>

standardGamma

Draw samples from a standard Gamma distribution.

fun standardGamma(shape: Double): Doublefun standardGamma(shape: DoubleArray): KtNDArray<Double>
fun standardGamma(shape: Double, vararg size: Int): KtNDArray<Double>
fun standardGamma(shape: DoubleArray, vararg size: Int): KtNDArray<Double>

standardNormal

Draw samples from a standard Normal distribution (mean=0, stdev=1).

fun standardNormal(): Doublefun standardNormal(vararg size: Int): KtNDArray<Double>

standardT

Draw samples from a standard Student’s t distribution with df degrees of freedom.

fun standardT(df: Double): Doublefun standardT(df: DoubleArray): KtNDArray<Double>
fun standardT(df: Double, vararg size: Int): KtNDArray<Double>
fun standardT(df: DoubleArray, vararg size: Int): KtNDArray<Double>

standartCauchy

Draw samples from a standard Cauchy distribution with mode = 0.

fun standartCauchy(): Doublefun standartCauchy(vararg size: Int): KtNDArray<Double>

triangular

Draw samples from the triangular distribution over the interval [left, right].

fun triangular(left: Double, mode: Double, right: Double): Doublefun triangular(left: DoubleArray, mode: Double, right: Double): KtNDArray<Double>
fun triangular(left: Double, mode: DoubleArray, right: Double): KtNDArray<Double>
fun triangular(left: Double, mode: Double, right: DoubleArray): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: DoubleArray, right: Double): KtNDArray<Double>
fun triangular(left: Double, mode: DoubleArray, right: DoubleArray): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: Double, right: DoubleArray): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: DoubleArray, right: DoubleArray): KtNDArray<Double>
fun triangular(left: Double, mode: Double, right: Double, vararg size: Int): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: Double, right: Double, vararg size: Int): KtNDArray<Double>
fun triangular(left: Double, mode: DoubleArray, right: Double, vararg size: Int): KtNDArray<Double>
fun triangular(left: Double, mode: Double, right: DoubleArray, vararg size: Int): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: DoubleArray, right: Double, vararg size: Int): KtNDArray<Double>
fun triangular(left: Double, mode: DoubleArray, right: DoubleArray, vararg size: Int): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: Double, right: DoubleArray, vararg size: Int): KtNDArray<Double>
fun triangular(left: DoubleArray, mode: DoubleArray, right: DoubleArray, vararg size: Int): KtNDArray<Double>

uniform

Draw samples from a uniform distribution.

fun uniform(low: Double = 0.0, high: Double = 1.0): Doublefun uniform(low: DoubleArray, high: Double = 1.0): KtNDArray<Double>
fun uniform(low: Double = 0.0, high: DoubleArray): KtNDArray<Double>
fun uniform(low: DoubleArray, high: DoubleArray): KtNDArray<Double>
fun uniform(low: Double = 0.0, high: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun uniform(low: DoubleArray, high: Double = 1.0, vararg size: Int): KtNDArray<Double>
fun uniform(low: Double = 0.0, high: DoubleArray, vararg size: Int): KtNDArray<Double>
fun uniform(low: DoubleArray, high: DoubleArray, vararg size: Int): KtNDArray<Double>

vonmises

Draw samples from a von Mises distribution.

fun vonmises(mu: Double, kappa: Double): Doublefun vonmises(mu: DoubleArray, kappa: Double): KtNDArray<Double>
fun vonmises(mu: Double, kappa: DoubleArray): KtNDArray<Double>
fun vonmises(mu: DoubleArray, kappa: DoubleArray): KtNDArray<Double>
fun vonmises(mu: Double, kappa: Double, vararg size: Int): KtNDArray<Double>
fun vonmises(mu: DoubleArray, kappa: Double, vararg size: Int): KtNDArray<Double>
fun vonmises(mu: Double, kappa: DoubleArray, vararg size: Int): KtNDArray<Double>
fun vonmises(mu: DoubleArray, kappa: DoubleArray, vararg size: Int): KtNDArray<Double>

wald

Draw samples from a Wald, or inverse Gaussian, distribution.

fun wald(mean: Double, scale: Double): Doublefun wald(mean: DoubleArray, scale: Double): KtNDArray<Double>
fun wald(mean: Double, scale: DoubleArray): KtNDArray<Double>
fun wald(mean: DoubleArray, scale: DoubleArray): KtNDArray<Double>
fun wald(mean: Double, scale: Double, vararg size: Int): KtNDArray<Double>
fun wald(mean: DoubleArray, scale: Double, vararg size: Int): KtNDArray<Double>
fun wald(mean: Double, scale: DoubleArray, vararg size: Int): KtNDArray<Double>
fun wald(mean: DoubleArray, scale: DoubleArray, vararg size: Int): KtNDArray<Double>

weibull

Draw samples from a Weibull distribution.

fun weibull(a: Double): Doublefun weibull(a: DoubleArray): KtNDArray<Double>
fun weibull(a: Double, vararg size: Int): KtNDArray<Double>
fun weibull(a: DoubleArray, vararg size: Int): KtNDArray<Double>

zipf

Draw samples from a Zipf distribution.

fun zipf(a: Double): Longfun zipf(a: DoubleArray): KtNDArray<Long>
fun zipf(a: Double, vararg size: Int): KtNDArray<Long>
fun zipf(a: DoubleArray, vararg size: Int): KtNDArray<Long>