diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-12 14:43:40 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-12 14:43:40 -0400 |
commit | a1fc3c5cfe2ff1fa01c488d4e130b6592be1f111 (patch) | |
tree | 2e8d66584569fa7ef278695ddb78d11676375fff /src/filters.h | |
parent | 0fb6bf4189c57802fafb611f18f419cd6b588ac4 (diff) | |
download | fork-ledger-a1fc3c5cfe2ff1fa01c488d4e130b6592be1f111.tar.gz fork-ledger-a1fc3c5cfe2ff1fa01c488d4e130b6592be1f111.tar.bz2 fork-ledger-a1fc3c5cfe2ff1fa01c488d4e130b6592be1f111.zip |
The --anon option now randomizes its effect
Diffstat (limited to 'src/filters.h')
-rw-r--r-- | src/filters.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/filters.h b/src/filters.h index e981dcd4..0f414151 100644 --- a/src/filters.h +++ b/src/filters.h @@ -334,18 +334,26 @@ public: class anonymize_posts : public item_handler<post_t> { - typedef std::map<commodity_t *, std::size_t> commodity_index_map; + typedef std::map<commodity_t *, std::size_t> commodity_index_map; + typedef variate_generator<mt19937&, uniform_int<> > int_generator_t; temporaries_t temps; commodity_index_map comms; std::size_t next_comm_id; xact_t * last_xact; + mt19937 rnd_gen; + uniform_int<> integer_range; + int_generator_t integer_gen; anonymize_posts(); public: anonymize_posts(post_handler_ptr handler) - : item_handler<post_t>(handler), next_comm_id(0), last_xact(NULL) { + : item_handler<post_t>(handler), next_comm_id(0), last_xact(NULL), + rnd_gen(static_cast<unsigned int>(reinterpret_cast<uintmax_t>(this) + + static_cast<uintmax_t>(std::time(0)))), + integer_range(1, 2000000000L), + integer_gen(rnd_gen, integer_range) { TRACE_CTOR(anonymize_posts, "post_handler_ptr"); } virtual ~anonymize_posts() { |