Campo · Weighted Array Element

Campo · Weighted Array Element · helpers.weightedArrayElement. Metodo di generazione · Esempio

helpers.weightedArrayElement

Impostazioni

Genera dati per vedere i risultati.

Parametri & Esempio

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.

Esempio

"draft"

Usa dati sintetici nell’ambiente di test.

Generatori correlati

Esplora gli scenari