Merge pull request #357 from bd2019us/AMQ-7199

[AMQ-7199] Replace Math.Random with Random.nextDouble
This commit is contained in:
Jean-Baptiste Onofré 2019-08-19 19:28:59 +02:00 committed by GitHub
commit fb7d4e6c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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);