From 679917390bbb71b33d82be55ff55e21ed041dadd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 28 Jun 2021 00:46:27 +0200 Subject: global-functions: $GetRandomNumber: use $HexToNum --- global-functions | 13 ++----------- 1 file 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 -- cgit v1.2.3-70-g09d2