randomlySelect

fun randomlySelect(array: IntArray, streamNum: Int): Int(source)
fun randomlySelect(array: DoubleArray, streamNum: Int): Double(source)

Randomly select an element from the array

Return

the randomly selected value

Parameters

array

the array to select from

streamNum

the stream number from the stream provider to use


fun randomlySelect(array: IntArray, stream: RNStreamIfc = defaultRNStream()): Int(source)
fun randomlySelect(array: DoubleArray, stream: RNStreamIfc = defaultRNStream()): Double(source)

Randomly select an element from the array

Return

the randomly selected value

Parameters

array

the array to select from, must not be empty

stream

the source of randomness


fun randomlySelect(array: DoubleArray, cdf: DoubleArray, streamNum: Int): Double(source)
fun randomlySelect(array: IntArray, cdf: DoubleArray, streamNum: Int): Int(source)

Randomly selects from the array using the supplied cdf

Return

the randomly selected value

Parameters

array

array to select from

cdf

the cumulative probability associated with each element of the array

streamNum

the stream number from the stream provider to use


fun randomlySelect(array: DoubleArray, cdf: DoubleArray, stream: RNStreamIfc = defaultRNStream()): Double(source)

Randomly selects from the array using the supplied cdf

Return

the randomly selected value

Parameters

array

array to select from

cdf

the cumulative probability associated with each element of array

stream

the source of randomness


fun randomlySelect(array: IntArray, cdf: DoubleArray, stream: RNStreamIfc = defaultRNStream()): Int(source)

Randomly selects from the array using the supplied cdf

Return

the randomly selected value

Parameters

array

array to select from

cdf

the cumulative probability associated with each element of the array

stream

the source of randomness


fun <T> randomlySelect(list: List<T>, cdf: DoubleArray, streamNum: Int): T(source)

Randomly selects from the list using the supplied cdf

Return

the randomly selected value

Parameters

list

list to select from

cdf

the cumulative probability associated with each element of the array

streamNum

the stream number from the stream provider to use

Type Parameters

T

the type returned


fun <T> randomlySelect(list: List<T>, cdf: DoubleArray, stream: RNStreamIfc = defaultRNStream()): T(source)

Randomly selects from the list using the supplied cdf

Return

the randomly selected value

Parameters

list

list to select from

cdf

the cumulative probability associated with each element of the array

stream

the source of randomness

Type Parameters

T

the type returned


fun <T> randomlySelect(list: List<T>, streamNum: Int): T(source)

Randomly select from the list

Return

the randomly selected element

Parameters

list

the list

streamNum

the stream number from the stream provider to use

Type Parameters

T

The type of element in the list


fun <T> randomlySelect(list: List<T>, stream: RNStreamIfc = defaultRNStream()): T(source)

Randomly select from the list

Return

the randomly selected element

Parameters

list

the list

stream

the source of randomness

Type Parameters

T

The type of element in the list