Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46866
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 26 Mar 2009 11:06:06 +0000 (11:06 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 26 Mar 2009 11:06:06 +0000 (11:06 +0000)
Better init of Random

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@758596 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardServer.java
java/org/apache/catalina/tribes/util/UUIDGenerator.java
test/org/apache/catalina/tribes/demos/LoadTest.java
test/org/apache/catalina/tribes/demos/MapDemo.java
test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java
test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java
test/org/apache/catalina/tribes/test/io/TestSenderConnections.java

index 3c7099c..184972f 100644 (file)
@@ -420,7 +420,7 @@ public final class StandardServer
             int expected = 1024; // Cut off to avoid DoS attack
             while (expected < shutdown.length()) {
                 if (random == null)
-                    random = new Random(System.currentTimeMillis());
+                    random = new Random();
                 expected += (random.nextInt() % 1024);
             }
             while (expected > 0) {
index 4514f49..2fc83a1 100644 (file)
@@ -31,7 +31,7 @@ public class UUIDGenerator {
     public static final int BITS_PER_BYTE = 8;
     
     protected static SecureRandom secrand = null;
-    protected static Random rand = new Random(System.currentTimeMillis());
+    protected static Random rand = new Random();
     static {
         secrand = new SecureRandom();
         secrand.setSeed(rand.nextLong());
index 35cb795..38e303c 100644 (file)
@@ -251,7 +251,7 @@ public class LoadTest implements MembershipListener,ChannelListener, Runnable {
     public static class LoadMessage extends ByteMessage {
         
         public static byte[] outdata = new byte[size];
-        public static Random r = new Random(System.currentTimeMillis());
+        public static Random r = new Random();
         public static int getMessageSize (LoadMessage msg) {
             return msg.getMessage().length;
         }
index 0f67e88..08db8e6 100644 (file)
@@ -399,7 +399,7 @@ public class MapDemo implements ChannelListener, MembershipListener{
             dataModel.getValueAt(-1,-1);
         }
 
-        public static Random random = new Random(System.currentTimeMillis());
+        public static Random random = new Random();
         public static String random(int count, int start, int end, boolean letters, boolean numbers,
                                     char[] chars ) {
             if (count == 0) {
index 63a71b4..c5bf7b3 100644 (file)
@@ -166,7 +166,7 @@ public class TestDataIntegrity extends TestCase {
         public int length;
         public byte[] data;
         public byte key;
-        public static Random r = new Random(System.currentTimeMillis());
+        public static Random r = new Random();
         public static Data createRandomData() {
             int i = r.nextInt();
             i = ( i % 127 );
index 4074a45..33e8eb9 100644 (file)
@@ -198,7 +198,7 @@ public class TestMulticastPackages extends TestCase {
         public byte[] data;
         public byte key;
         public boolean hasNr = false;
-        public static Random r = new Random(System.currentTimeMillis());
+        public static Random r = new Random();
         public static Data createRandomData() {
             return createRandomData(ChannelReceiver.MAX_UDP_SIZE);
         }
index ac8c22f..03b051a 100644 (file)
@@ -112,7 +112,7 @@ public class TestRemoteProcessException extends TestCase {
         public byte[] data;
         public byte key;
         public boolean error = false;
-        public static Random r = new Random(System.currentTimeMillis());
+        public static Random r = new Random();
         public static Data createRandomData(boolean error) {
             int i = r.nextInt();
             i = ( i % 127 );
index 5ed1b9a..5af6411 100644 (file)
@@ -240,7 +240,7 @@ public class TestUdpPackages extends TestCase {
         public byte[] data;
         public byte key;
         public boolean hasNr = false;
-        public static Random r = new Random(System.currentTimeMillis());
+        public static Random r = new Random();
         public static Data createRandomData() {
             return createRandomData(ChannelReceiver.MAX_UDP_SIZE);
         }
index ea9c286..8ee9057 100644 (file)
@@ -94,7 +94,7 @@ public class TestSenderConnections extends TestCase {
     }
     
     public static class TestMsg implements Serializable {
-        static Random r = new Random(System.currentTimeMillis());
+        static Random r = new Random();
         HashMap<Integer, ArrayList<Object>> map =
             new HashMap<Integer, ArrayList<Object>>();
         public TestMsg() {