mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: $GetRandomNumber: use $HexToNum
This commit is contained in:
@@ -416,18 +416,9 @@
|
||||
}
|
||||
|
||||
:global GetRandom20CharHex;
|
||||
:global HexToNum;
|
||||
|
||||
:local Num;
|
||||
:local 40CharHex ([ $GetRandom20CharHex ] . [ $GetRandom20CharHex ]);
|
||||
|
||||
:for I from=0 to=39 do={
|
||||
:local Char [ :pick $40CharHex $I ];
|
||||
:if ($Char~"[0-9]") do={
|
||||
:set Num ($Num . $Char);
|
||||
}
|
||||
}
|
||||
|
||||
:return ([ :tonum [ :pick $Num 0 18 ] ] % $Max);
|
||||
:return ([ $HexToNum [ :pick [ $GetRandom20CharHex ] 0 15 ] ] % $Max);
|
||||
}
|
||||
|
||||
# convert from hex (string) to num
|
||||
|
||||
Reference in New Issue
Block a user