aboutsummaryrefslogtreecommitdiff
path: root/src/line_accumulator.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-04-30 20:06:48 +0200
committerAdrian Kummerlaender2016-04-30 20:06:48 +0200
commit05c4ee3665445eadf094ccab395518e992c337d4 (patch)
tree67fb9db0c5fece4a7cd18bd6aa46322e2bcbaeff /src/line_accumulator.h
parent5eb3689c9985f28b46651f547b9b32d55b4a07b5 (diff)
downloadjustify-05c4ee3665445eadf094ccab395518e992c337d4.tar
justify-05c4ee3665445eadf094ccab395518e992c337d4.tar.gz
justify-05c4ee3665445eadf094ccab395518e992c337d4.tar.bz2
justify-05c4ee3665445eadf094ccab395518e992c337d4.tar.lz
justify-05c4ee3665445eadf094ccab395518e992c337d4.tar.xz
justify-05c4ee3665445eadf094ccab395518e992c337d4.tar.zst
justify-05c4ee3665445eadf094ccab395518e992c337d4.zip
Implement `--seed` argumentHEADmaster
Enables users to customize the seed used for the pseudorandom number generator.
Diffstat (limited to 'src/line_accumulator.h')
-rw-r--r--src/line_accumulator.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/line_accumulator.h b/src/line_accumulator.h
index 69b4c74..db75c8c 100644
--- a/src/line_accumulator.h
+++ b/src/line_accumulator.h
@@ -9,23 +9,28 @@ namespace justify {
class LineAccumulator {
public:
- LineAccumulator(const std::uint8_t max_length, const std::uint8_t offset);
+ LineAccumulator(
+ const std::uint8_t max_length,
+ const std::uint8_t offset,
+ const std::uint32_t seed
+ );
~LineAccumulator();
- std::uint8_t getMissing() const;
-
void operator()(const std::string& token);
private:
const std::uint8_t max_length_;
const std::uint8_t offset_;
+ std::mt19937 generator_;
std::uint8_t length_;
std::vector<
std::pair<std::string, std::uint8_t>
> tokens_;
+ std::uint8_t getMissing() const;
+
void justify();
void discharge(const bool full);