diff --git a/triqs/mc_tools/generator.hpp b/triqs/mc_tools/generator.hpp index 7b076139..6e29c38d 100644 --- a/triqs/mc_tools/generator.hpp +++ b/triqs/mc_tools/generator.hpp @@ -33,7 +33,13 @@ namespace boost{ buf->fill(); return *cur++; } - generator(generator const & rhs) + inline R const preview() { + if (cur == end) + buf->fill(); + return *cur; + } + + generator(generator const & rhs) : buf(new buffer (*rhs.buf)) , cur(buf->cur) diff --git a/triqs/mc_tools/random_generator.hpp b/triqs/mc_tools/random_generator.hpp index 79107f13..f3c75557 100644 --- a/triqs/mc_tools/random_generator.hpp +++ b/triqs/mc_tools/random_generator.hpp @@ -59,6 +59,9 @@ namespace mc_tools { INTEGER_OVERLOAD(size_t) #undef INTEGER_OVERLOAD + /// Returns a double in [0,1[ with flat distribution + double preview() { return gen->preview();} + /// Returns a double in [0,1[ with flat distribution double operator()() { return ((*gen)());}