diff options
author | Christian Hesse <mail@eworm.de> | 2021-06-28 00:46:27 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-06-28 21:33:13 +0200 |
commit | 679917390bbb71b33d82be55ff55e21ed041dadd (patch) | |
tree | 75c0b4348ca8b584396831aa478767793fe6301b /global-functions | |
parent | cfc400b3d5dd200644673f4dc39636e231979724 (diff) |
global-functions: $GetRandomNumber: use $HexToNum
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/global-functions b/global-functions index 14b045e..654642e 100644 --- a/global-functions +++ b/global-functions @@ -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 |