mirror of https://github.com/apache/activemq.git
Merge pull request #357 from bd2019us/AMQ-7199
[AMQ-7199] Replace Math.Random with Random.nextDouble
This commit is contained in:
commit
fb7d4e6c4d
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue