You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/12/11 21:20:40 UTC
svn commit: r1420383 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate-stress/TestSenderAndReceiver.cpp
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));
}
}