Index: src/LinearAlgebra/Makefile.am
===================================================================
--- src/LinearAlgebra/Makefile.am	(revision 819cbed89a1b1c8ad28590a925dbf1e1e2054c50)
+++ src/LinearAlgebra/Makefile.am	(revision b81f1c37e2cae3aa13b96b83b26fd5091886b161)
@@ -48,5 +48,4 @@
 libMolecuilderLinearAlgebra_la_LIBADD = \
 	../Exceptions/libMolecuilderExceptions.la \
-	../RandomNumbers/libMolecuilderRandomNumbers.la \
 	$(GSL_LIBS)
 nobase_libMolecuilderLinearAlgebra_la_include_HEADERS = ${LINALGHEADER}
Index: src/LinearAlgebra/RealSpaceMatrix.cpp
===================================================================
--- src/LinearAlgebra/RealSpaceMatrix.cpp	(revision 819cbed89a1b1c8ad28590a925dbf1e1e2054c50)
+++ src/LinearAlgebra/RealSpaceMatrix.cpp	(revision b81f1c37e2cae3aa13b96b83b26fd5091886b161)
@@ -28,6 +28,4 @@
 #include "LinearAlgebra/Vector.hpp"
 #include "LinearAlgebra/VectorContent.hpp"
-#include "RandomNumbers/RandomNumberGeneratorFactory.hpp"
-#include "RandomNumbers/RandomNumberGenerator.hpp"
 
 #include <gsl/gsl_blas.h>
@@ -123,30 +121,24 @@
   set(2,1, cos(y)*sin(x));
   set(2,2, cos(x)*cos(y));
-}
-
-void RealSpaceMatrix::setRandomRotation()
-{
-  double phi[NDIM];
-  RandomNumberGenerator &random = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator();
-  const double rng_min = random.min();
-  const double rng_max = random.max();
-
-
-  for (int i=0;i<NDIM;i++) {
-    phi[i] = (random()/(rng_max-rng_min))*(2.*M_PI);
-    std::cout << "Random angle is " << phi[i] << std::endl;
-  }
-
-  set(0,0,  cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2])));
-  set(0,1,  sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2])));
-  set(0,2,              cos(phi[1])*sin(phi[2])                                        );
-  set(1,0, -sin(phi[0])*cos(phi[1])                                                    );
-  set(1,1,  cos(phi[0])*cos(phi[1])                                                    );
-  set(1,2,              sin(phi[1])                                                    );
-  set(2,0, -cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2])));
-  set(2,1, -sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2])));
-  set(2,2,              cos(phi[1])*cos(phi[2])                                        );
-}
-
+//  double phi[NDIM];
+//  phi[0] = x;
+//  phi[0] = y;
+//  phi[0] = z;
+//  setRotation(phi);
+}
+
+void RealSpaceMatrix::setRotation(const double phi[NDIM])
+{
+  setRotation(phi[0], phi[1], phi[2]);
+//  set(0,0,  cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2])));
+//  set(0,1,  sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2])));
+//  set(0,2,              cos(phi[1])*sin(phi[2])                                        );
+//  set(1,0, -sin(phi[0])*cos(phi[1])                                                    );
+//  set(1,1,  cos(phi[0])*cos(phi[1])                                                    );
+//  set(1,2,              sin(phi[1])                                                    );
+//  set(2,0, -cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2])));
+//  set(2,1, -sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2])));
+//  set(2,2,              cos(phi[1])*cos(phi[2])                                        );
+}
 
 RealSpaceMatrix &RealSpaceMatrix::operator=(const RealSpaceMatrix &src)
Index: src/LinearAlgebra/RealSpaceMatrix.hpp
===================================================================
--- src/LinearAlgebra/RealSpaceMatrix.hpp	(revision 819cbed89a1b1c8ad28590a925dbf1e1e2054c50)
+++ src/LinearAlgebra/RealSpaceMatrix.hpp	(revision b81f1c37e2cae3aa13b96b83b26fd5091886b161)
@@ -74,6 +74,11 @@
    */
   void setRotation(const double x, const double y, const double z);
-  void setRandomRotation();
 
+  /**
+   * Sets all matrix corresponding to a rotation matrix,
+   * first around the x-, then the y-, finally the z-axis
+   * with given angles.
+   */
+  void setRotation(const double phi[NDIM]);
   /**
    * Access the matrix at index (i,j)
Index: src/boundary.cpp
===================================================================
--- src/boundary.cpp	(revision 819cbed89a1b1c8ad28590a925dbf1e1e2054c50)
+++ src/boundary.cpp	(revision b81f1c37e2cae3aa13b96b83b26fd5091886b161)
@@ -1044,4 +1044,31 @@
 }
 
+/** Sets given 3x3 matrix to a random rotation matrix.
+ *
+ * @param a matrix to set
+ */
+inline void setRandomRotation(RealSpaceMatrix &a)
+{
+  double phi[NDIM];
+  RandomNumberGenerator &random = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator();
+  const double rng_min = random.min();
+  const double rng_max = random.max();
+
+  for (int i=0;i<NDIM;i++) {
+    phi[i] = (random()/(rng_max-rng_min))*(2.*M_PI);
+    std::cout << "Random angle is " << phi[i] << std::endl;
+  }
+
+  a.set(0,0,  cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2])));
+  a.set(0,1,  sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2])));
+  a.set(0,2,              cos(phi[1])*sin(phi[2])                                        );
+  a.set(1,0, -sin(phi[0])*cos(phi[1])                                                    );
+  a.set(1,1,  cos(phi[0])*cos(phi[1])                                                    );
+  a.set(1,2,              sin(phi[1])                                                    );
+  a.set(2,0, -cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2])));
+  a.set(2,1, -sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2])));
+  a.set(2,2,              cos(phi[1])*cos(phi[2])                                        );
+}
+
 /** Fills the empty space of the simulation box with water.
  * \param *filler molecule which the box is to be filled with
@@ -1131,5 +1158,5 @@
         // ... and rotation matrix
         if (DoRandomRotation)
-          Rotations.setRandomRotation();
+          setRandomRotation(Rotations);
         else
           Rotations.setIdentity();
@@ -1191,5 +1218,5 @@
     // otherwise translate and randomize to final position
     if (DoRandomRotation)
-      Rotations.setRandomRotation();
+      setRandomRotation(Rotations);
     else
       Rotations.setIdentity();
