window.avg
window.avg(numeric_values [, should_ignore_zero_values])
Descripción
Devuelve el promedio de los valores de entrada (que pueden ser números enteros o números de punto flotante). Si configuras el segundo argumento opcional como verdadero, se ignoran los valores cero.
Tipos de datos de parámetros
INT|FLOAT
Tipo de datos que se muestra
FLOAT
Muestras de código
Ejemplo 1
En este ejemplo, se muestra el promedio de números enteros.
// This rule sets the outcome $size_mode to the average
// file size in the 5 minute match window.
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$size_mode = window.avg($e.file.size) // yields 2.5 if the event file size values in the match window are 1, 2, 3 and 4
Ejemplo 2
En este ejemplo, se muestra el promedio de flotación.
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$size_mode = window.avg($e.file.size) // yields 1.75 if the event file size values in the match window are 1.1 and 2.4
Ejemplo 3
Promedio de entrada negativo
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$size_mode = window.avg($e.file.size) // yields 0.6 if the event file size values in the match window are -1.1, 1.1, 0.0 and 2.4
Ejemplo 4
0 devoluciones 0
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$size_mode = window.avg($e.file.size) // yields 0 if the event file size values in the match window is 0
Ejemplo 5
Se ignoran los valores 0
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$size_mode = window.avg($e.file.size, true) // yields 394 if the event file size values in the match window are 0, 0, 0 and 394