Add hex seed option to stress command.

Allows the output command and stress command to stream the same data.
Also allows tests to be repeated.
diff --git a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/OutputCommand.java b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/OutputCommand.java
index b27b197..305f957 100644
--- a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/OutputCommand.java
+++ b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/OutputCommand.java
@@ -97,7 +97,7 @@
     /** The random seed as a byte[]. */
     @Option(names = {"-x", "--hex-seed"},
             description = {"The hex-encoded random seed.",
-                           "Bytes for other primitives use little-endian format.",
+                           "Seed conversion for multi-byte primitives use little-endian format.",
                            "Over-rides the --seed parameter."})
     private String byteSeed;
 
diff --git a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestCommand.java b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestCommand.java
index a963ede..53b0ec0 100644
--- a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestCommand.java
+++ b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestCommand.java
@@ -160,6 +160,13 @@
                            "generators sequentially, each appropriately byte reversed for the platform."})
     private boolean raw64;
 
+    /** The random seed as a byte[]. */
+    @Option(names = {"-x", "--hex-seed"},
+            description = {"The hex-encoded random seed.",
+                           "Seed conversion for multi-byte primitives use little-endian format.",
+                           "Use to repeat tests. Not recommended for batch testing."})
+    private String byteSeed;
+
     /**
      * Flag to indicate the output should be combined with a hashcode from a new object.
      * This is a method previously used in the
@@ -456,7 +463,7 @@
                     }
                 }
                 // Create the generator. Explicitly create a seed so it can be recorded.
-                final byte[] seed = testData.getRandomSource().createSeed();
+                final byte[] seed = createSeed(testData.getRandomSource());
                 UniformRandomProvider rng = testData.createRNG(seed);
 
                 // Upper or lower bits from 64-bit generators must be created first.
@@ -498,6 +505,24 @@
     }
 
     /**
+     * Creates the seed. This will call {@link RandomSource#createSeed()} unless a hex seed has
+     * been explicitly specified on the command line.
+     *
+     * @param randomSource Random source.
+     * @return the seed
+     */
+    private byte[] createSeed(RandomSource randomSource) {
+        if (byteSeed != null) {
+            try {
+                return Hex.decodeHex(byteSeed);
+            } catch (IllegalArgumentException ex) {
+                throw new ApplicationException("Invalid hex seed: " + ex.getMessage(), ex);
+            }
+        }
+        return randomSource.createSeed();
+    }
+
+    /**
      * Submit the tasks to the executor service.
      *
      * @param service The executor service.