Francois Gouget : testbot: Simplify and speed up GenerateRandomString().
Alexandre Julliard
julliard at winehq.org
Tue Feb 4 13:07:48 CST 2020
Module: tools
Branch: master
Commit: d14d2f504e8f0da4599ed388233734c10fbc4849
URL: https://source.winehq.org/git/tools.git/?a=commit;h=d14d2f504e8f0da4599ed388233734c10fbc4849
Author: Francois Gouget <fgouget at 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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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);
More information about the wine-cvs
mailing list