You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/03/10 11:42:31 UTC
[commons-rng] branch master updated (de8c604 -> 18d88c0)
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git.
from de8c604 Add TSampler to continuous sampler performance JMH example
new d4a8346 Add missing generator name to example command
new 18d88c0 Add option to list a range of the RandomSource enum
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
commons-rng-examples/examples-stress/HOWTO.md | 2 +-
.../commons/rng/examples/stress/ListCommand.java | 15 ++++++++++++++-
.../rng/examples/stress/StressTestDataList.java | 19 +++++++++++++++++++
commons-rng-examples/examples-stress/stress_test.md | 6 ++++++
4 files changed, 40 insertions(+), 2 deletions(-)
[commons-rng] 01/02: Add missing generator name to example command
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git
commit d4a83466a20c6c8e79b31e2d69d8604198509f35
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Mar 10 10:20:57 2022 +0000
Add missing generator name to example command
---
commons-rng-examples/examples-stress/HOWTO.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commons-rng-examples/examples-stress/HOWTO.md b/commons-rng-examples/examples-stress/HOWTO.md
index 9edb880..54c8093 100644
--- a/commons-rng-examples/examples-stress/HOWTO.md
+++ b/commons-rng-examples/examples-stress/HOWTO.md
@@ -49,7 +49,7 @@ in a variety of formats. To create a random file of 16K (2 buffers of 8196 bytes
To output numbers from the `KISS` generator as raw bits, integers and unsigned integers:
- java -jar target/examples-stress.jar output -f BITS -x 0123456789abcdef
+ java -jar target/examples-stress.jar output KISS -f BITS -x 0123456789abcdef
Since the seed is provided this output should be reproducible across platforms:
[commons-rng] 02/02: Add option to list a range of the RandomSource enum
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git
commit 18d88c0634d1d151f64863b951f7f18dd1b6929e
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Mar 10 11:10:30 2022 +0000
Add option to list a range of the RandomSource enum
---
.../commons/rng/examples/stress/ListCommand.java | 15 ++++++++++++++-
.../rng/examples/stress/StressTestDataList.java | 19 +++++++++++++++++++
commons-rng-examples/examples-stress/stress_test.md | 6 ++++++
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ListCommand.java b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ListCommand.java
index c91f450..d1b2816 100644
--- a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ListCommand.java
+++ b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ListCommand.java
@@ -58,6 +58,16 @@ class ListCommand implements Callable<Void> {
paramLabel = "<provider>")
private ProviderType providerType = ProviderType.ALL;
+ /** The minimum entry in the provider enum. */
+ @Option(names = {"--min"},
+ description = {"The minimum entry in the provider enum (inclusive)."})
+ private int min = 0;
+
+ /** The maximum entry in the provider enum. */
+ @Option(names = {"--max"},
+ description = {"The maximum entry in the provider enum (inclusive)."})
+ private int max = Integer.MAX_VALUE;
+
/** The prefix for each ID in the template list of random generators. */
@Option(names = {"-p", "--prefix"},
description = {"The ID prefix.",
@@ -104,6 +114,9 @@ class ListCommand implements Callable<Void> {
} else if (providerType == ProviderType.LONG) {
list = list.subsetLongSource();
}
+ if (min != 0 || max != Integer.MAX_VALUE) {
+ list = list.subsetRandomSource(min, max);
+ }
// Write in one call to the output
final StringBuilder sb = new StringBuilder();
switch (listFormat) {
@@ -168,7 +181,7 @@ class ListCommand implements Callable<Void> {
static void writeStressTestData(Appendable appendable,
Iterable<StressTestData> testData) throws IOException {
// Build the widths for each column
- int idWidth = 0;
+ int idWidth = 1;
int randomSourceWidth = 15;
for (final StressTestData data : testData) {
idWidth = Math.max(idWidth, data.getId().length());
diff --git a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestDataList.java b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestDataList.java
index 5d6ddd5..1614164 100644
--- a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestDataList.java
+++ b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/StressTestDataList.java
@@ -119,4 +119,23 @@ class StressTestDataList implements Iterable<StressTestData> {
}
return subset;
}
+
+ /**
+ * Create a subset of the list containing only instances of RandomSource within the
+ * specified range of the enum. The first value in the enum corresponds to entry 1.
+ *
+ * @param min Minimum entry (inclusive)
+ * @param max Maximum entry (inclusive)
+ * @return the stress test data list
+ */
+ public StressTestDataList subsetRandomSource(int min, int max) {
+ final StressTestDataList subset = new StressTestDataList();
+ for (final StressTestData data : list) {
+ final int entry = data.getRandomSource().ordinal() + 1;
+ if (min <= entry && entry <= max) {
+ subset.list.add(data);
+ }
+ }
+ return subset;
+ }
}
diff --git a/commons-rng-examples/examples-stress/stress_test.md b/commons-rng-examples/examples-stress/stress_test.md
index 56cb3ed..dcd0f31 100644
--- a/commons-rng-examples/examples-stress/stress_test.md
+++ b/commons-rng-examples/examples-stress/stress_test.md
@@ -153,6 +153,12 @@ This will produce a list of generators:
2 WELL_512_A 1
...
+A subset range of the `RandomSource` enum can be specified using a minimum and/or maximum
+entry in the enum order, starting from 1. This can be used to create a list of recently
+added generators, for example:
+
+ java -jar target/examples-stress.jar list --min 34
+
Arguments can be specified for those generators that require them. Note that the identifier for
each line, corresponding to a tested generator, must be unique. The identifier will be used to name
the output results file for the generator.