Module: tools Branch: master Commit: d14d2f504e8f0da4599ed388233734c10fbc4849 URL: https://source.winehq.org/git/tools.git/?a=commit;h=d14d2f504e8f0da4599ed388... Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Tue Feb 4 15:52:07 2020 +0100 testbot: Simplify and speed up GenerateRandomString(). Perl's rand() function can return random values greater than 2^16 nowadays. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- testbot/lib/WineTestBot/Utils.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm index e8ba516..27b222f 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -201,8 +201,8 @@ sub GenerateRandomString($) my $RandomString = ""; while (length($RandomString) < $Len) { - my $Part = "0000" . sprintf("%lx", int(rand(2 ** 16))); - $RandomString .= substr($Part, -4); + $RandomString .= sprintf("%08x", int(rand(2 ** 32))); + } return substr($RandomString, 0, $Len);