public static DoubleVector rnorm(int n,double mean,double sd,Random random){
  if (sd < 0.0)   throw new IllegalArgumentException("standard deviation < 0.0");
  if (sd == 0.0)   return new DoubleVector(n,mean);
  DoubleVector v=new DoubleVector(n);
  for (int i=0; i < n; i++)   v.set(i,(random.nextGaussian() + mean) / sd);
  return v;
}

public static DoubleVector rnorm ( int n , double mean , double sd , Random random ) { if ( sd < 0.0 ) throw new IllegalArgumentException ( "standard deviation < 0.0" ) ; if ( sd == 0.0 ) return new DoubleVector ( n , mean ) ; DoubleVector v = new DoubleVector ( n ) ; for ( int i = 0 ; i < n ; i ++ ) v . set ( i , ( random . nextGaussian ( ) + mean ) / sd ) ; return v ; }
generates a sample of a normal distribution .
