activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1420384 - /activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp
Date Tue, 11 Dec 2012 20:23:33 GMT
Author: tabish
Date: Tue Dec 11 20:23:32 2012
New Revision: 1420384

URL: http://svn.apache.org/viewvc?rev=1420384&view=rev
Log:
Use the Random class properly to get consistent behavior cross platform. 

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp?rev=1420384&r1=1420383&r2=1420384&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp
Tue Dec 11 20:23:32 2012
@@ -72,8 +72,6 @@ void TestSenderAndReceiver::run() {
     Random random;
     int i, j;
 
-    j = random.nextInt(100);
-
     while (!closing) {
         std::stringstream str;
         str << sendIndex;
@@ -83,9 +81,9 @@ void TestSenderAndReceiver::run() {
         message.append(";");
 
         // Add variable payload
-        j = (int) ((rand() * 1024) / RAND_MAX);
+        j = random.nextInt(1024);
         for (i = 0; i < j; i++) {
-            message += string(1, (char) (65 + ((rand() * 26) / RAND_MAX)));
+            message += string(1, (char) (65 + random.nextInt(26)));
         }
 
         errorReturn = CMS_SUCCESS;



Mime
View raw message