From a1fc3c5cfe2ff1fa01c488d4e130b6592be1f111 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 12 Jun 2010 14:43:40 -0400 Subject: The --anon option now randomizes its effect --- src/filters.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/filters.h') 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 { - typedef std::map commodity_index_map; + typedef std::map commodity_index_map; + typedef variate_generator > 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(handler), next_comm_id(0), last_xact(NULL) { + : item_handler(handler), next_comm_id(0), last_xact(NULL), + rnd_gen(static_cast(reinterpret_cast(this) + + static_cast(std::time(0)))), + integer_range(1, 2000000000L), + integer_gen(rnd_gen, integer_range) { TRACE_CTOR(anonymize_posts, "post_handler_ptr"); } virtual ~anonymize_posts() { -- cgit v1.2.3