Index: src/RandomNumbers/RandomNumberDistribution_Encapsulation.hpp
===================================================================
--- src/RandomNumbers/RandomNumberDistribution_Encapsulation.hpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/RandomNumberDistribution_Encapsulation.hpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -38,7 +38,4 @@
 #include "RandomNumberDistribution.hpp"
 
-#include "RandomNumberGeneratorFactory.hpp"
-#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
-
 /** Template class that encapsulates the random number distributions from
  *  random::boost.
@@ -56,10 +53,4 @@
   >
 {
-  /**
-   * Factory is friend such that it can access private cstor.
-   */
-  friend class RandomNumberGeneratorFactory;
-  friend class RandomNumberGeneratorFactoryTest;
-
 public:
 
Index: src/RandomNumbers/RandomNumberEngine_Encapsulation.hpp
===================================================================
--- src/RandomNumbers/RandomNumberEngine_Encapsulation.hpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/RandomNumberEngine_Encapsulation.hpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -34,10 +34,4 @@
 #include "RandomNumberEngine.hpp"
 
-//#include "RandomNumberGeneratorFactory.hpp"
-//#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
-
-class RandomNumberGeneratorFactory;
-class RandomNumberGeneratorFactoryTest;
-
 /** Template class that encapsulates the random number engines from
  *  random::boost.
@@ -55,10 +49,4 @@
   >
 {
-  /**
-   * Factory is friend such that it can access private cstor.
-   */
-  friend class RandomNumberGeneratorFactory;
-  friend class RandomNumberGeneratorFactoryTest;
-
 public:
   /** Set the engine's seed.
Index: src/RandomNumbers/RandomNumberGeneratorFactory.cpp
===================================================================
--- src/RandomNumbers/RandomNumberGeneratorFactory.cpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/RandomNumberGeneratorFactory.cpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -55,5 +55,5 @@
       !GeneratorPrototypeTable.empty();
       iter = GeneratorPrototypeTable.begin()) {
-    EmptyPrototypeTable< std::map<RandomNumberDistributionFactory::TypeList,ICreator<RandomNumberGenerator> *> > (iter->second);
+    EmptyPrototypeTable< std::map<RandomNumberDistributionFactory::TypeList,Clone<RandomNumberGenerator> *> > (iter->second);
     GeneratorPrototypeTable.erase(iter);
   }
@@ -71,5 +71,5 @@
   BOOST_PP_SEQ_FOR_EACH_PRODUCT(SequenceElementizer, (engine_seq_a)(distribution_seq))
 
-#define suffixseq ()(<> > )
+#define suffixseq ()(<>)
 #define tableseq (*EnginePrototypeTable)(*DistributionPrototypeTable)
 #define name_spaces_seq (RandomNumberEngineFactory::)(RandomNumberDistributionFactory::)
@@ -91,9 +91,9 @@
 #define ParamItemPrinter(z,n,sequence)
 
-#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, size_tupels, distributionengine_seqseq, GeneratorPrototypeTable, TableItemPrinter, new Creator< RandomNumberGenerator BOOST_PP_COMMA() RandomNumberGenerator_Encapsulation , TemplateItemPrinter, ParamItemPrinter)
+#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, size_tupels, distributionengine_seqseq, GeneratorPrototypeTable, TableItemPrinter, new RandomNumberGenerator_Encapsulation , TemplateItemPrinter, ParamItemPrinter)
 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(distributionengine_seqseq)-1 )
 #include BOOST_PP_LOCAL_ITERATE()
 
-#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, size_tupels, distributionengine_seqseq_a, GeneratorPrototypeTable, TableItemPrinter, new Creator< RandomNumberGenerator BOOST_PP_COMMA() RandomNumberGenerator_Encapsulation , TemplateItemPrinter, ParamItemPrinter)
+#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, size_tupels, distributionengine_seqseq_a, GeneratorPrototypeTable, TableItemPrinter, new RandomNumberGenerator_Encapsulation , TemplateItemPrinter, ParamItemPrinter)
 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(distributionengine_seqseq_a)-1 )
 #include BOOST_PP_LOCAL_ITERATE()
@@ -103,5 +103,5 @@
 {
   // Instantiate and return (implicitly creates a copy of the stored prototype)
-  return (GeneratorPrototypeTable[engine][distribution]->create());
+  return (GeneratorPrototypeTable[engine][distribution]->clone());
 }
 
@@ -123,5 +123,5 @@
   } else
     dis_type = distribution;
-  return (GeneratorPrototypeTable[ eng_type ][ dis_type ]->create());
+  return (GeneratorPrototypeTable[ eng_type ][ dis_type ]->clone());
 }
 
Index: src/RandomNumbers/RandomNumberGeneratorFactory.hpp
===================================================================
--- src/RandomNumbers/RandomNumberGeneratorFactory.hpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/RandomNumberGeneratorFactory.hpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -15,4 +15,6 @@
 
 #include "CodePatterns/Singleton.hpp"
+
+#include "CodePatterns/Clone.hpp"
 
 #include "RandomNumberDistributionFactory.hpp"
@@ -99,5 +101,5 @@
       std::map<
         RandomNumberDistributionFactory::TypeList,
-        ICreator<RandomNumberGenerator> *>
+        Clone<RandomNumberGenerator> *>
   > EngineDistributionTable;
 
Index: src/RandomNumbers/RandomNumberGenerator_Encapsulation.hpp
===================================================================
--- src/RandomNumbers/RandomNumberGenerator_Encapsulation.hpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/RandomNumberGenerator_Encapsulation.hpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -48,9 +48,12 @@
 #include <typeinfo>
 
-#include "CodePatterns/Creator.hpp"
+#include "CodePatterns/Clone.hpp"
+#include "RandomNumberDistribution_Encapsulation.hpp"
+#include "RandomNumberDistributionFactory.hpp"
+#include "RandomNumberEngine_Encapsulation.hpp"
+#include "RandomNumberEngineFactory.hpp"
 #include "RandomNumberGenerator.hpp"
 
-#include "RandomNumberGeneratorFactory.hpp"
-#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
+class RandomNumberGeneratorFactory;
 
 /** Template class that encapsulates the random number generators from
@@ -64,6 +67,6 @@
  * might be integer or even a discrete distribution of integers.
  *
- * We need three template parameters:
- * -# the generator - generates uniform random numbers
+ * We need two template parameters:
+ * -# the engine - generates uniform random numbers
  * -# the distribution - transforms uniform into a desired distribution
  */
@@ -71,16 +74,11 @@
 class RandomNumberGenerator_Encapsulation :
   public RandomNumberGenerator,
-  public Creator<
-    RandomNumberGenerator,
-    RandomNumberGenerator_Encapsulation<engine, distribution>
-  >
+  public Clone<RandomNumberGenerator>
 {
   /**
-   * Factory is friend such that it can access private cstor.
+   * Factory is friend such that it can access private cstor when filling its
+   * table
    */
   friend class RandomNumberGeneratorFactory;
-  friend class RandomNumberGeneratorFactoryTest;
-
-  friend class Creator< RandomNumberGenerator, RandomNumberGenerator_Encapsulation<engine, distribution> >;
 
 public:
@@ -89,5 +87,5 @@
    */
   double operator()() const {
-    return randomgenerator();
+    return (*randomgenerator)();
   }
 
@@ -97,5 +95,5 @@
    */
   void seed(unsigned int _seed) {
-    engine_type.seed(_seed);
+    engine_type->seed(_seed);
   }
 
@@ -104,5 +102,5 @@
    */
   std::string EngineName() {
-    return typeid(engine_type).name();
+    return engine_type->name();
   }
 
@@ -111,18 +109,69 @@
    */
   std::string DistributionName() {
-    return typeid(distribution_type).name();
+    return distribution_type->name();
+  }
+
+  /** Clones the current instance and returns pointer.
+   *
+   * @return pointer to cloned instance
+   */
+  RandomNumberGenerator* clone() const
+  {
+    RandomNumberGenerator_Encapsulation<engine, distribution> *MyClone = NULL;
+
+    // sadly (due to construction of variate_generator without any abstract
+    // base class) we need RTTI here ...
+    RandomNumberEngine *engine_clone =
+        RandomNumberEngineFactory::getInstance().getProduct(typeid(engine));
+    RandomNumberDistribution *distribution_clone =
+        RandomNumberDistributionFactory::getInstance().getProduct(typeid(distribution));
+
+    MyClone = new RandomNumberGenerator_Encapsulation<engine, distribution>(
+        engine_clone,
+        distribution_clone
+        );
+
+    return MyClone;
+  }
+
+protected:
+  /** Constructor that instantiates a specific random number generator and
+   * distribution.
+   *
+   * This is one is supposed to create the prototypes. Hence, must only be
+   * called from the factory.
+   */
+  RandomNumberGenerator_Encapsulation() :
+    engine_type(NULL),
+    distribution_type(NULL),
+    randomgenerator(NULL)
+  {
+    engine_type = RandomNumberEngineFactory::getInstance().getProduct(typeid(engine));
+    distribution_type = RandomNumberDistributionFactory::getInstance().getProduct(typeid(distribution));
+    randomgenerator = new boost::variate_generator<engine, distribution>(
+        (dynamic_cast<RandomNumberEngine_Encapsulation<engine> *>(engine_type))
+        ->getEngine(),
+        (dynamic_cast<RandomNumberDistribution_Encapsulation<distribution> *>(distribution_type))
+        ->getDistribution());
   }
 
   /** Constructor that instantiates a specific random number generator and
    * distribution.
-   * @param _generator_type instance of the desired generator
+   * @param _engine_type instance of the desired generator
    * @param _distribution_type instance of the desired distribution
    */
-  RandomNumberGenerator_Encapsulation() :
+  RandomNumberGenerator_Encapsulation(
+      RandomNumberEngine *_engine_type,
+      RandomNumberDistribution *_distribution_type
+      ) :
+    engine_type(_engine_type),
+    distribution_type(_distribution_type),
     randomgenerator(
-        boost::variate_generator<engine, distribution> (
-            engine_type,
-            distribution_type)
-        )
+        new boost::variate_generator<engine, distribution> (
+            (dynamic_cast<RandomNumberEngine_Encapsulation<engine> *>(engine_type))
+            ->getEngine(),
+            (dynamic_cast<RandomNumberDistribution_Encapsulation<distribution> *>(distribution_type))
+            ->getDistribution())
+    )
   {}
 
@@ -130,9 +179,16 @@
    *
    */
-  virtual ~RandomNumberGenerator_Encapsulation() {}
+  virtual ~RandomNumberGenerator_Encapsulation()
+  {
+    // NULL pointer may be deleted
+    delete engine_type;
+    delete distribution_type;
+    delete randomgenerator;
+  }
+protected:
+  RandomNumberEngine *engine_type;
+  RandomNumberDistribution *distribution_type;\
 private:
-  engine engine_type;
-  distribution distribution_type;
-  mutable boost::variate_generator<engine, distribution> randomgenerator;
+  mutable boost::variate_generator<engine, distribution> *randomgenerator;
 };
 
Index: src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.cpp
===================================================================
--- src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.cpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.cpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -75,4 +75,6 @@
 void RandomNumberGeneratorFactoryTest::setUp()
 {
+  rng = NULL;
+
   RandomNumberGeneratorFactory::getInstance();
 }
@@ -80,4 +82,6 @@
 void RandomNumberGeneratorFactoryTest::tearDown()
 {
+  delete rng;
+
   RandomNumberDistributionFactory::purgeInstance();
   RandomNumberEngineFactory::purgeInstance();
@@ -87,9 +91,8 @@
 void RandomNumberGeneratorFactoryTest::GeneratorTest()
 {
-  RandomNumberGenerator *rng = NULL;
   // check one of the engines and distributions
   rng = RandomNumberGeneratorFactory::getInstance().
       GeneratorPrototypeTable[RandomNumberEngineFactory::minstd_rand0]
-                              [RandomNumberDistributionFactory::uniform_smallint]->create();
+                              [RandomNumberDistributionFactory::uniform_smallint]->clone();
   CPPUNIT_ASSERT_EQUAL(
       std::string(typeid(boost::minstd_rand0).name()),
@@ -100,6 +103,3 @@
       rng->DistributionName()
   );
-  delete rng;
-
 }
-
Index: src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.hpp
===================================================================
--- src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.hpp	(revision 1d5a8713812642e80f03e59bcd85a3ffedbe20b5)
+++ src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.hpp	(revision 076a7747f6149944af692526338b96c2659d9e53)
@@ -14,4 +14,5 @@
 #endif
 
+class RandomNumberGenerator;
 
 #include <cppunit/extensions/HelperMacros.h>
@@ -30,4 +31,5 @@
 
 private:
+  RandomNumberGenerator *rng;
 };
 
