randomlySelect

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

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
fun randomlySelect(array: DoubleArray, stream: RNStreamIfc = defaultRNStream()): Double

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
fun randomlySelect(array: IntArray, cdf: DoubleArray, streamNum: Int): Int

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

streamNum

the stream number from the stream provider to use


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

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 <T> randomlySelect(list: List<T>, cdf: DoubleArray, streamNum: Int): T

Randomly selects from the list using the supplied cdf

Return

the randomly selected value

Parameters

T

the type returned

list

list to select from

cdf

the cumulative probability associated with each element of array

streamNum

the stream number from the stream provider to use


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

Randomly selects from the list using the supplied cdf

Return

the randomly selected value

Parameters

T

the type returned

list

list to select from

cdf

the cumulative probability associated with each element of array

stream

the source of randomness


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

Randomly select from the list

Return

the randomly selected element

Parameters

T

The type of element in the list

list

the list

streamNum

the stream number from the stream provider to use


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

Randomly select from the list

Return

the randomly selected element

Parameters

T

The type of element in the list

list

the list

stream

the source of randomness