amazon-ion / ion-java-benchmark-cli

Apache License 2.0
7 stars 9 forks source link

Adds option to allow generate the same random data. #51

Closed linlin-s closed 2 years ago

linlin-s commented 2 years ago

Issue #, if available: N/A

Description of changes: This PR adds an option --seed which allows users to specify the seed value when generating random ion data. If the provided seed value and the schema file are the same as the last execution, the same randomized ion data will be generated.

GeneratorOptions.java Add a static field randomSeed to the class GeneratorOptions. This field will be overwrote in the step of processing the --seed option. If the seed value provided, the random instance will be crated with the specified seed value and be used in the following data generation process. Otherwise, the random instance will be created with a random seed value.

Main.java Add an option --seed which allow users to specify the seed value. When they re-run the command with the same seed value and the same input ion schema, the same randomized ion data will be generated.

Test

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.