Campo · Weighted Array Element

Campo · Weighted Array Element · helpers.weightedArrayElement. Método de generación · Ejemplo

helpers.weightedArrayElement

Opciones del generador

Genera datos para ver los resultados.

Parámetros & Ejemplo

Returns a weighted random element from the given array. Each element of the array should be an object with two keys weight and value.

helpers.weightedArrayElement(array: ReadonlyArray<{ weight: number; value: T; }>)
array
Array to pick the value from.
array[].weight
The weight of the value.
array[].value
The value to pick.

Ejemplo

"draft"

Usa datos sintéticos en el entorno de prueba.

Generadores relacionados

Explorar escenarios