aboutsummaryrefslogtreecommitdiff
path: root/justify.cc
diff options
context:
space:
mode:
Diffstat (limited to 'justify.cc')
-rw-r--r--justify.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/justify.cc b/justify.cc
index c417dfd..9115d83 100644
--- a/justify.cc
+++ b/justify.cc
@@ -23,6 +23,11 @@ boost::optional<boost::program_options::variables_map> input(
boost::program_options::value<int>(),
"Number of spaces to be prepended on each line"
)
+ (
+ "seed",
+ boost::program_options::value<std::uint32_t>(),
+ "Seed for pseudorandomly distributing missing spaces"
+ )
;
boost::program_options::variables_map variables;
@@ -51,8 +56,9 @@ bool process(const boost::program_options::variables_map& variables) {
std::cout.sync_with_stdio(false);
std::cin.sync_with_stdio(false);
- std::uint8_t line_length = 60;
- std::uint8_t line_offset = 0;
+ std::uint8_t line_length = 60;
+ std::uint8_t line_offset = 0;
+ std::uint32_t seed = 3473018784;
if ( variables.count("length") ) {
const int user_length = variables["length"].as<int>();
@@ -78,7 +84,11 @@ bool process(const boost::program_options::variables_map& variables) {
}
}
- justify::LineAccumulator acc{line_length, line_offset};
+ if ( variables.count("seed") ) {
+ seed = variables["seed"].as<std::uint32_t>();
+ }
+
+ justify::LineAccumulator acc{line_length, line_offset, seed};
std::string token;
while ( std::cin.good() ) {