You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2019/08/19 17:30:34 UTC

[activemq] branch activemq-5.15.x updated: [AMQ-7199] Replace Math.Random with Random.nextDouble

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch activemq-5.15.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.15.x by this push:
     new c346dba  [AMQ-7199] Replace Math.Random with Random.nextDouble
c346dba is described below

commit c346dbaf5c6065d4f64d355ee053b83a1d317595
Author: bd2019us <>
AuthorDate: Fri May 10 21:39:53 2019 -0500

    [AMQ-7199] Replace Math.Random with Random.nextDouble
---
 assembly/src/release/examples/openwire/ecommerce/src/Retailer.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/assembly/src/release/examples/openwire/ecommerce/src/Retailer.java b/assembly/src/release/examples/openwire/ecommerce/src/Retailer.java
index 01ecfef..5b76459 100644
--- a/assembly/src/release/examples/openwire/ecommerce/src/Retailer.java
+++ b/assembly/src/release/examples/openwire/ecommerce/src/Retailer.java
@@ -24,6 +24,7 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TemporaryQueue;
 
+import java.util.Random;
 /**
  * The Retailer orders computers from the Vendor by sending a message via
  * the VendorOrderQueue. It then syncronously receives the reponse message
@@ -58,7 +59,8 @@ public class Retailer implements Runnable {
 			for (int i = 0; i < 5; i++) {
 				MapMessage message = session.createMapMessage();
 				message.setString("Item", "Computer(s)");
-				int quantity = (int)(Math.random() * 4) + 1;
+				Random rand = new Random();
+				int quantity = (int)(rand.nextDouble() * 4) + 1;
 				message.setInt("Quantity", quantity);
 				message.setJMSReplyTo(retailerConfirmQueue);
 				producer.send(message);