Random Type

Contains operations relating to pseudo-random number generation.

Constructors

Constructor Description

Random()

Full Usage: Random()

Returns: Random
Returns: Random

Static members

Static member Description

Random.Bernoulli()

Full Usage: Random.Bernoulli()

Returns: float

Samples a random value from the Bernoulli distribution.

Returns: float

Random.Bernoulli(prob)

Full Usage: Random.Bernoulli(prob)

Parameters:
    prob : float

Returns: float

Samples a random value from the Bernoulli distribution with the given probability.

prob : float
Returns: float

Random.Choice(array, probs)

Full Usage: Random.Choice(array, probs)

Parameters:
    array : 'a[]
    probs : float[]

Returns: 'a

Samples a value at random from the given array using the given categorical probabilities.

array : 'a[]
probs : float[]
Returns: 'a

Random.Choice(array)

Full Usage: Random.Choice(array)

Parameters:
    array : 'a[]

Returns: 'a

Samples a value at random from the given array.

array : 'a[]
Returns: 'a

Random.ChoiceIndex(probs)

Full Usage: Random.ChoiceIndex(probs)

Parameters:
    probs : float[]

Returns: int

Samples an index at random with the given categorical probabilities.

probs : float[]
Returns: int

Random.Double(low, high)

Full Usage: Random.Double(low, high)

Parameters:
    low : float
    high : float

Returns: float

Samples a double value in the given range [low, high)

low : float
high : float
Returns: float

Random.Double()

Full Usage: Random.Double()

Returns: float

Samples a double value in the range [0, 1)

Returns: float

Random.Integer(low, high)

Full Usage: Random.Integer(low, high)

Parameters:
    low : int
    high : int

Returns: int

Samples a random integer in the given range [low, high).

low : int
high : int
Returns: int

Random.Integer()

Full Usage: Random.Integer()

Returns: int

Samples a non-negative random integer

Returns: int

Random.Multinomial(probs, numSamples)

Full Usage: Random.Multinomial(probs, numSamples)

Parameters:
    probs : float[,]
    numSamples : int

Returns: int[,]

Returns a 2D array where each row contains `numSamples` indices sampled from the multinomial probability distribution defined by the probabilities in the corresponding row of the `probs` array.

probs : float[,]
numSamples : int
Returns: int[,]

Random.Multinomial(probs, numSamples)

Full Usage: Random.Multinomial(probs, numSamples)

Parameters:
    probs : float[]
    numSamples : int

Returns: int[]

Samples a number of random values array of random values for the given weighted distribution

probs : float[]
numSamples : int
Returns: int[]

Random.Normal(mean, stddev)

Full Usage: Random.Normal(mean, stddev)

Parameters:
    mean : float
    stddev : float

Returns: float

Samples a random value from the normal distribution with the given mean and standard deviation.

mean : float
stddev : float
Returns: float

Random.Normal()

Full Usage: Random.Normal()

Returns: float

Samples a random value from the standard normal distribution with mean 0 and standard deviation 1.

Returns: float

Random.Seed(seed)

Full Usage: Random.Seed(seed)

Parameters:
    seed : int

Sets the random seed.

seed : int

Random.Shuffle(array)

Full Usage: Random.Shuffle(array)

Parameters:
    array : 'a[]

Returns: 'a[]

Returns an array that is a randomly-shuffled version of the given array, using the Durstenfeld/Knuth shuffle.

array : 'a[]
Returns: 'a[]

Random.UUID()

Full Usage: Random.UUID()

Returns: string

Returns a universally unique identifier (UUID) string

Returns: string

Random.Uniform(low, high)

Full Usage: Random.Uniform(low, high)

Parameters:
    low : float
    high : float

Returns: float

Samples a random value from the uniform distribution with the given parameters [low, high).

low : float
high : float
Returns: float

Random.Uniform()

Full Usage: Random.Uniform()

Returns: float

Samples a random value from the standard uniform distribution over the interval [0,1).

Returns: float

© Copyright 2021, DiffSharp Contributors.