diff --git a/global-functions b/global-functions index fb30680..6f1776b 100644 --- a/global-functions +++ b/global-functions @@ -245,3 +245,16 @@ } :return $Result; } + +# generate random number +# Warning: This is a *very* weak algorithm and in *no way* +# useful for cryptography or similar! +:global GetRandom do={ + :local Max ([ :tonum $1 ] + 1); + :local Sum 0; + + :foreach Interface in=[ /interface find ] do={ + :set Sum ($Sum + [ /interface get $Interface tx-byte ]); + } + :return ($Sum % $Max); +}