activemq-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1420383&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=1420383&r1=1420382&r2=1420383&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:20:38 2012
@@ -72,7 +72,7 @@ void TestSenderAndReceiver::run() {
     Random random;
     int i, j;
 
-    j = (int) ((random.nextInt() * 50) / RAND_MAX);
+    j = random.nextInt(100);
 
     while (!closing) {
         std::stringstream str;
@@ -98,7 +98,7 @@ void TestSenderAndReceiver::run() {
         }
 
         // Sleep for up to 1 second between sends
-        Thread::sleep(((random.nextInt() * 1000) / RAND_MAX));
+        Thread::sleep(random.nextInt(500));
     }
 }
 



Mime
View raw message