Index: /issm/trunk-jpl/src/c/shared/Random/randomgenerator.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Random/randomgenerator.cpp	(revision 26573)
+++ /issm/trunk-jpl/src/c/shared/Random/randomgenerator.cpp	(revision 26574)
@@ -5,2 +5,75 @@
 #include <iostream>
 #include "./randomgenerator.h"
+
+#undef M_PI
+#define M_PI 3.141592653589793238462643
+
+namespace rdn
+{
+	uniform_distribution::uniform_distribution(){/*{{{*/
+
+		a   = 1103515245; 	// BSD Formula
+		c  = 12345;					// BSD Formula
+		m = 2147483648;			// BSD Formula
+		_seed = 0;
+		lbound = 0.0;
+		ubound = 1.0;
+		return;
+	}
+	/*}}}*/
+	uniform_distribution::uniform_distribution(double lower,double upper){/*{{{*/
+
+		a   = 1103515245;		// BSD Formula
+		c  = 12345;					// BSD Formula
+		m = 2147483648;			// BSD Formula
+		_seed = 0;
+		lbound = lower;
+		ubound = upper;
+		return;
+	}
+	/*}}}*/
+	uniform_distribution::~uniform_distribution(){}
+	void uniform_distribution::seed( unsigned int s ) { _seed = s; }
+	unsigned int uniform_distribution::get_seed() { return _seed; }
+	double uniform_distribution::generator() {
+		_seed = ( a * _seed + c ) % m ;
+		return (ubound-lbound)*(double) _seed/ m + lbound;
+	}
+
+
+	normal_distribution::normal_distribution(){/*{{{*/
+
+		_seed = 0;
+		mean   = 0;
+		sdev  = 1.0;
+		return;
+	}
+	/*}}}*/
+	normal_distribution::normal_distribution(double m,double s){/*{{{*/
+
+		_seed = 0;
+		mean   = m;
+		sdev  = s;
+		return;
+	}
+	/*}}}*/
+	normal_distribution::~normal_distribution(){}
+	void normal_distribution::seed( unsigned int s ) { _seed = s; }
+	double normal_distribution::generator(){/*{{{*/
+
+		uniform_distribution unifdistri;
+		unifdistri.seed(_seed);
+
+		double u1 = unifdistri.generator();
+		double u2 = unifdistri.generator();
+
+		double R = sqrt(-2*log(u1));
+		double theta = 2*M_PI*u2;
+
+		seed(unifdistri.get_seed());
+
+		return mean + sdev * (R*cos(theta));
+
+	}
+	/*}}}*/
+}
Index: /issm/trunk-jpl/src/c/shared/Random/randomgenerator.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Random/randomgenerator.h	(revision 26573)
+++ /issm/trunk-jpl/src/c/shared/Random/randomgenerator.h	(revision 26574)
@@ -6,59 +6,52 @@
 #define _RANDOMGENERATOR_H_
 
-#undef M_PI
-#define M_PI 3.141592653589793238462643
+namespace rdn
+{
+  class uniform_distribution
+  {
 
-class uniform_distribution_rnd
-{
+    private:
 
-  private:
-    int a;
-    int c;
-    unsigned int m;
-    unsigned _seed;
-    double a1;
-    double a2;
+      unsigned int a;       //multiplier of the linear congruential generator
+      unsigned int c;       //increment of the linear congruential generator
+      unsigned int m;       // modulo of the linear congruential generator
+      unsigned int _seed;   // seed value
+      double lbound;        // lower bound of uniform distribution
+      double ubound;        // upper bound of uniform distribution
 
-    int rnd_int() { return( _seed = ( a * _seed + c ) % m ); }
+    public:
 
-  public:
-    uniform_distribution_rnd() : _seed( 0 ), a( 1103515245 ), c( 12345 ), m( 2147483648 ), a1(0.0), a2(1.0) {}
-    uniform_distribution_rnd(double a_1,double a_2) : _seed( 0 ), a( 1103515245 ), c( 12345 ), m( 2147483648 ), a1(a_1), a2(a_2) {}
-    void seed( unsigned int s ) { _seed = s; }
-    unsigned int get_seed() { return _seed; }
-    double rnd() { return (a2-a1)*(double) rnd_int()/ m + a1; }
+      /*constructors, destructors: */
+      uniform_distribution();
+      uniform_distribution(double a_1, double a_2);
+      ~uniform_distribution();
 
-};
+      void seed( unsigned int s );
+      unsigned int get_seed();
+      double generator();
 
-class normal_distribution_rnd
-{
+  };
 
-  private:
-    unsigned _seed;
-    double mean;
-    double sdev;
+  class normal_distribution
+  {
 
-  public:
-    normal_distribution_rnd() : _seed( 0 ), mean( 0), sdev(1.0) {}
-    normal_distribution_rnd(double m,double s) : _seed( 0 ), mean( m ), sdev(s) {}
-    void seed( unsigned int s ) { _seed = s; }
-    double rnd()
-    {
-      uniform_distribution_rnd unifdistri;
-      unifdistri.seed(_seed);
+    private:
+      unsigned int _seed; // seed value
+      double mean;        // mean value
+      double sdev;        // standard deviation
 
-      double u1 = unifdistri.rnd();
-      double u2 = unifdistri.rnd();
+    public:
 
-      double R = sqrt(-2*log(u1));
-      double theta = 2*M_PI*u2;
+      /*constructors, destructors: */
+      normal_distribution();
+      normal_distribution(double m,double s);
+      ~normal_distribution();
 
-      seed(unifdistri.get_seed());
+      void seed( unsigned int s );
+      double generator();
 
-      return mean + sdev * (R*cos(theta));
+  };
 
-    }
 
-};
-
+}
 #endif //ifndef _RANDOMGENERATOR_H_
Index: /issm/trunk-jpl/src/c/solutionsequences/solutionsequence_sampling.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solutionsequences/solutionsequence_sampling.cpp	(revision 26573)
+++ /issm/trunk-jpl/src/c/solutionsequences/solutionsequence_sampling.cpp	(revision 26574)
@@ -18,5 +18,5 @@
 
 	/*Define seed*/
-	normal_distribution_rnd distribution;
+	rdn::normal_distribution distribution;
 	if(seed<0){
 		std::random_device rd;
@@ -38,5 +38,5 @@
 	ppf->GetLocalSize(&M);
 	for(int i=0;i<M;i++){
-		rdnumber = distribution.rnd();
+		rdnumber = distribution.generator();
 		ppf->SetValue(local_indices[i],rdnumber,INS_VAL);
 	}
