Index: trunk/psLib/src/fits/psFitsScale.c
===================================================================
--- trunk/psLib/src/fits/psFitsScale.c	(revision 23231)
+++ trunk/psLib/src/fits/psFitsScale.c	(revision 23259)
@@ -112,6 +112,5 @@
     // psImageBackground automatically excludes pixels that are non-finite, so we don't need to bother about a
     // mask.
-    psU64 seed = p_psRandomGetSystemSeed(false);
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, seed);
+    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
     psStats *stats = psStatsAlloc(MEAN_STAT | STDEV_STAT); // Statistics object
     if (!psImageBackground(stats, NULL, image, mask, maskVal, rng)) {
@@ -290,6 +289,5 @@
     if (!psMemIncrRefCounter(rng) && options->fuzz) {
         // Don't blab about which seed we're going to get --- it's not necessary for this purpose
-        psU64 seed = p_psRandomGetSystemSeed(false);
-        rng = psRandomAlloc(PS_RANDOM_TAUS, seed);
+        rng = psRandomAlloc(PS_RANDOM_TAUS);
     }
 
Index: trunk/psLib/src/math/psRandom.c
===================================================================
--- trunk/psLib/src/math/psRandom.c	(revision 23231)
+++ trunk/psLib/src/math/psRandom.c	(revision 23259)
@@ -29,4 +29,5 @@
 #include <inttypes.h>
 
+#include "psAbort.h"
 #include "psMemory.h"
 #include "psRandom.h"
@@ -38,19 +39,24 @@
 
 
+unsigned long seed = 0;                 // Seed for RNG
+
+
 psU64 p_psRandomGetSystemSeed(bool log)
 {
-    FILE*  fd;
-    psU64  seedVal = 0;
-    time_t timeVal;
+    psU64 seedVal = 0;                  // Seed value to return
 
-    fd = fopen("/dev/urandom","r");
-    if(fd == NULL) {
-        // Read system clock to get seed
-        seedVal = (psU64)time(&timeVal);
-    } else {
-        // Read urandom to get seed
-        if (fread(&seedVal, sizeof(psU64),1,fd)) {;} // ignore return value
-        // Close file
-        fclose(fd);
+    // Since zero is a special value in our context, don't allow the final value chosen to be zero
+    while (seedVal == 0) {
+        FILE *fd = fopen("/dev/urandom", "r");
+        if (fd) {
+            // Read urandom to get seed
+            if (fread(&seedVal, sizeof(psU64), 1, fd)) {;} // ignore return value
+            // Close file
+            fclose(fd);
+        } else {
+            // Read system clock to get seed
+            time_t timeVal;                 // Time value
+            seedVal = (psU64)time(&timeVal);
+        }
     }
 
@@ -63,100 +69,94 @@
 }
 
-psRandom *psRandomAlloc(psRandomType type,
-                        unsigned long seed)
+psU64 psRandomSeed(psU64 value)
 {
-    gsl_rng   *r      = NULL;
-    psRandom  *myRNG  = NULL;
+    while (value == 0) {
+        value = p_psRandomGetSystemSeed(true);
+    }
+    seed = value;
+    return seed;
+}
 
+// Destructor for psRandom
+static void randomFree(psRandom *rng)
+{
+    if (rng->gsl) {
+        gsl_rng_free(rng->gsl);
+    }
+    return;
+}
+
+// Constructor for psRandom
+static psRandom *randomAlloc(psRandomType type)
+{
+    psRandom *rng = psAlloc(sizeof(psRandom)); // Random number generator to return
+    psMemSetDeallocator(rng, (psFreeFunc)randomFree);
+
+    rng->type = type;
+
+    const gsl_rng_type *gslType;        // Type of RNG according to GSL
     switch (type) {
-    case PS_RANDOM_TAUS:
-        myRNG = (psRandom*)psAlloc(sizeof(psRandom));
-        r = gsl_rng_alloc(gsl_rng_taus);
-        myRNG->gsl = r;
-        if(seed == 0) {
-            gsl_rng_set(myRNG->gsl, p_psRandomGetSystemSeed(true));
-        } else {
-            gsl_rng_set(myRNG->gsl, seed);
-        }
-        myRNG->type = type;
+      case PS_RANDOM_TAUS:
+        gslType = gsl_rng_taus;
         break;
-
-    default:
-        psError(PS_ERR_UNEXPECTED_NULL, true, _("Unknown Random Number Generator Type"));
+      default:
+        psAbort("Unknown Random Number Generator Type: %x", type);
         break;
     }
 
-    return(myRNG);
+    rng->gsl = gsl_rng_alloc(gslType);
+    return rng;
 }
 
-void psRandomReset(psRandom *rand,
-                   unsigned long seed)
+psRandom *psRandomAlloc(psRandomType type)
 {
-    // Check null psRandom
-    if(rand==NULL) {
-        psError(PS_ERR_UNEXPECTED_NULL,
-                true,
-                _("Random variable is NULL."));
-    } else {
-        // Check seed value to see if system seed should be used
-        if(seed == 0) {
-            gsl_rng_set(rand->gsl,p_psRandomGetSystemSeed(true));
-        } else {
-            gsl_rng_set(rand->gsl, seed);
-        }
+    psRandom *rng = randomAlloc(type);
+    psRandomReset(rng);
+
+    return rng;
+}
+
+psRandom *psRandomAllocSpecific(psRandomType type, psU64 specificSeed)
+{
+    psRandom *rng = randomAlloc(type);
+    if (specificSeed == 0) {
+        specificSeed = p_psRandomGetSystemSeed(true);
     }
+    gsl_rng_set(rng->gsl, specificSeed);
+    return rng;
+}
+
+bool psRandomReset(psRandom *rand)
+{
+    PS_ASSERT_RANDOM_NON_NULL(rand, false);
+    if (seed == 0) {
+        seed = p_psRandomGetSystemSeed(true);
+    }
+    gsl_rng_set(rand->gsl, seed);
+    return true;
 }
 
 double psRandomUniform(const psRandom *r)
 {
-    // Check null psRandom variable
-    if(r == NULL) {
-        psError(PS_ERR_UNEXPECTED_NULL,
-                true,
-                _("Random variable is NULL."));
-        return(0);
-    } else {
-        return(gsl_rng_uniform(r->gsl));
-    }
+    PS_ASSERT_RANDOM_NON_NULL(r, NAN);
+    return gsl_rng_uniform(r->gsl);
 }
 
 double psRandomGaussian(const psRandom *r)
 {
-    // Check null psRandom variable
-    if(r == NULL) {
-        psError(PS_ERR_UNEXPECTED_NULL,
-                true,
-                _("Random variable is NULL."));
-        return(0);
-    } else {
-        // XXX: What should sigma be?
-        return(gsl_ran_gaussian(r->gsl, 1.0));
-    }
+    PS_ASSERT_RANDOM_NON_NULL(r, NAN);
+    return gsl_ran_gaussian(r->gsl, 1.0);
 }
 
 double p_psRandomGaussian(const psRandom *r, double sigma)
 {
-    // Check null psRandom variable
-    if(r == NULL) {
-        psError(PS_ERR_UNEXPECTED_NULL,
-                true,
-                _("Random variable is NULL."));
-        return(0);
-    } else {
-        return(gsl_ran_gaussian(r->gsl, sigma));
-    }
+    PS_ASSERT_RANDOM_NON_NULL(r, NAN);
+    return gsl_ran_gaussian(r->gsl, sigma);
 }
 
 double psRandomPoisson(const psRandom *r, double mean)
 {
-    // Check null psRandom variable
-    if(r == NULL) {
-        psError(PS_ERR_UNEXPECTED_NULL,
-                true,
-                _("Random variable is NULL."));
-        return(0);
-    } else {
-        return((psF64) gsl_ran_poisson(r->gsl, mean));
-    }
+    PS_ASSERT_RANDOM_NON_NULL(r, NAN);
+    return gsl_ran_poisson(r->gsl, mean);
 }
 
Index: trunk/psLib/src/math/psRandom.h
===================================================================
--- trunk/psLib/src/math/psRandom.h	(revision 23231)
+++ trunk/psLib/src/math/psRandom.h	(revision 23259)
@@ -29,12 +29,10 @@
 #include <gsl/gsl_randist.h>
 
-/** Enumeration containing a flag for psRandom types.  */
+/// Random number generator types
 typedef enum {
     PS_RANDOM_TAUS                     ///< A maximally equidistributed combined Tausworthe generator.
 } psRandomType;
 
-/** Data structure for psRandom.
- *  Contains information on the psRandom type and GNU Scientific Library random number generator.
- */
+/// Random number generator
 typedef struct {
     psRandomType type;                 ///< The type of RNG
@@ -48,20 +46,28 @@
     );
 
-/** Allocates a psRandom struct.
- *
- *  @return psRandom*:    A new psRandom structure.
- */
+/// Set the seed to use for random number generators.
+///
+/// A seed value of zero indicates that the seed is to be generated from the system.
+/// The new seed value is returned
+psU64 psRandomSeed(psU64 seed           ///< Seed for RNG
+                   );
+
+/// Allocate a random number generator
+///
+/// The currently defined seed (via psRandomSeed) is used
 psRandom *psRandomAlloc(
-    psRandomType type,                 ///< The type of RNG
-    unsigned long seed                 ///< Known value with which to seed the RNG
+    psRandomType type                   ///< The type of RNG
 ) PS_ATTR_MALLOC;
 
-/** Resets an existing psRandom struct.
- *
- *  @return void
- */
-void psRandomReset(
-    psRandom *rand,                    ///< Existing psRandom struct to reset
-    unsigned long seed                 ///< Known value with which to seed the RNG
+/// Allocate a random number generator with a specific seed
+///
+/// A seed value of zero indicates that the seed is to be generated from the system.
+psRandom *psRandomAllocSpecific(psRandomType type, ///< The type of RNG
+                                psU64 specificSeed ///< The specific seed to use
+    );
+
+/// Resets an existing random number generator
+bool psRandomReset(
+    psRandom *rand                      ///< Random number generator to reset
 );
 
@@ -72,5 +78,5 @@
  */
 double psRandomUniform(
-    const psRandom *r                  ///< psRandom struct for RNG
+    const psRandom *r                  ///< Random number generator
 );
 
@@ -81,17 +87,14 @@
  */
 double psRandomGaussian(
-    const psRandom *r                  ///< psRandom struct for RNG
+    const psRandom *r                  ///< Random number generator
 );
 
-/** Random number generator based on a Gaussian deviate, N(0,1).
+/** Random number generator based on a Gaussian deviate with specified standard deviation.
  *  Uses gsl_ran_gaussian.
- *
- *  XXX: I created this since the above psLib spec for p_psRandomGaussian
- *  had no argument for sigma.  Verify that with IfA.
  *
  *  @return double:     Random number.
  */
 double p_psRandomGaussian(
-    const psRandom *r,                  ///< psRandom struct for RNG
+    const psRandom *r,                  ///< Random number generator
     double sigma
 );
@@ -103,5 +106,5 @@
  */
 double psRandomPoisson(
-    const psRandom *r,                 ///< psRandom struct for RNG
+    const psRandom *r,                  ///< Random number generator
     double mean                         ///< Mean value
 );
Index: trunk/psLib/test/fits/tap_psFitsImage.c
===================================================================
--- trunk/psLib/test/fits/tap_psFitsImage.c	(revision 23231)
+++ trunk/psLib/test/fits/tap_psFitsImage.c	(revision 23259)
@@ -12,5 +12,5 @@
 static psImage *generateImage(void)
 {
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 12345); // Random number generator
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 12345); // Random number generator
     psImage *image = psImageAlloc(NUMCOLS, NUMROWS, PS_TYPE_F32); // Generated image
     for (int y = 0; y < NUMROWS; y++) {
Index: trunk/psLib/test/imageops/convolutionBench.c
===================================================================
--- trunk/psLib/test/imageops/convolutionBench.c	(revision 23231)
+++ trunk/psLib/test/imageops/convolutionBench.c	(revision 23259)
@@ -68,5 +68,5 @@
 int main(int argc, char *argv[])
 {
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 0); // Random number generator
 
     printf("#%14s%16s        %8s        %8s\n", "Image", "Kernel", "Direct", "FFT");
Index: trunk/psLib/test/imageops/tap_psImageInterpolate2.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageInterpolate2.c	(revision 23231)
+++ trunk/psLib/test/imageops/tap_psImageInterpolate2.c	(revision 23259)
@@ -77,5 +77,5 @@
     psImage *variance = NULL; // generateVariance(xSize, ySize, type);
     psImage *mask = NULL; // generateMask(xSize, ySize);
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 12345);
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 12345);
 
     psImageInterpolation *interp = psImageInterpolationAlloc(mode, image, variance, mask, 0, NAN, NAN,
Index: trunk/psLib/test/math/tap_psMinimizeLMM.c
===================================================================
--- trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 23259)
@@ -95,5 +95,5 @@
     {
         psMemId id = psMemGetId();
-        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
+        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
         psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
         psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
@@ -203,5 +203,5 @@
     {
         psMemId id = psMemGetId();
-        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
+        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
         psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
         psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
Index: trunk/psLib/test/math/tap_psPolyFit1D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit1D.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psPolyFit1D.c	(revision 23259)
@@ -109,5 +109,5 @@
     psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
     psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using a known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = (flags & TS00_X_NULL) ? i : 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tap_psPolyFit2D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit2D.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psPolyFit2D.c	(revision 23259)
@@ -108,5 +108,5 @@
     yTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tap_psPolyFit3D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit3D.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psPolyFit3D.c	(revision 23259)
@@ -108,5 +108,5 @@
     zTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tap_psPolyFit4D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit4D.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psPolyFit4D.c	(revision 23259)
@@ -132,5 +132,5 @@
     tTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tap_psRandom.c
===================================================================
--- trunk/psLib/test/math/tap_psRandom.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psRandom.c	(revision 23259)
@@ -3,5 +3,5 @@
 work properly.
  
-    ensure that psRandom structs are properly allocated by psRandomAlloc().
+    ensure that psRandom structs are properly allocated by psRandomAllocSpecific().
     ensure that psRandomUniform() produces a sequence of numbers with
         proper mean and stdev.
@@ -47,12 +47,12 @@
     plan_tests(34);
 
-    // ensure that psRandom structs are properly allocated by psRandomAlloc()
+    // ensure that psRandom structs are properly allocated by psRandomAllocSpecific()
     {
         psMemId id = psMemGetId();
         // Valid type allocation
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
-        ok(myRNG->type == PS_RANDOM_TAUS, "psRandomAlloc() set type properly");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
+        ok(myRNG->type == PS_RANDOM_TAUS, "psRandomAllocSpecific() set type properly");
         psFree(myRNG);
         skip_end();
@@ -63,6 +63,6 @@
     {
         psMemId id = psMemGetId();
-        psRandom *myRNG = psRandomAlloc(100,SEED);
-        ok(myRNG == NULL, "psRandomAlloc() refused to generate psRandom with unallowed type");
+        psRandom *myRNG = psRandomAllocSpecific(100,SEED);
+        ok(myRNG == NULL, "psRandomAllocSpecific() refused to generate psRandom with unallowed type");
         psFree(myRNG);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
@@ -72,6 +72,6 @@
     {
         psMemId id = psMemGetId();
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS,-5);
-        ok(myRNG != NULL, "psRandomAlloc() allows negative seed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS,-5);
+        ok(myRNG != NULL, "psRandomAllocSpecific() allows negative seed");
         psFree(myRNG);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
@@ -85,7 +85,7 @@
         rans->n = rans->nalloc;
         psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAllocSpecific() failed");
 
         // Initialize vector data with random number
@@ -125,7 +125,7 @@
         rans->n = rans->nalloc;
         psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAllocSpecific() failed");
 
         // Initialize vector with random data
@@ -167,7 +167,7 @@
         rans->n = rans->nalloc;
         psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAllocSpecific() failed");
 
         // Initialize vector with random data
@@ -210,7 +210,7 @@
         rans02->n = rans02->nalloc;
 
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
 
 
@@ -252,5 +252,5 @@
     if (0) {
         psRandom *myRNG1 = NULL;
-        myRNG1 = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        myRNG1 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
         //    psLogSetDestination("dest:stderr");
         psLogSetDestination(0);
@@ -275,7 +275,7 @@
         rans02->n = rans02->nalloc;
 
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
 
 
@@ -325,7 +325,7 @@
         rans02->n = rans02->nalloc;
 
-        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
-        ok(myRNG != NULL, "psRandom struct was allocated properly");
-        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
 
         // Initialize vectors with random data
Index: trunk/psLib/test/math/tap_psStats07.c
===================================================================
--- trunk/psLib/test/math/tap_psStats07.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psStats07.c	(revision 23259)
@@ -58,6 +58,6 @@
     PS_ASSERT_INT_NONNEGATIVE(Npts, NULL);
 
-    //    psRandom *r = psRandomAlloc(PS_RANDOM_TAUS, p_psRandomGetSystemSeed());
-    psRandom *r = psRandomAlloc(PS_RANDOM_TAUS, PS_XXX_GAUSSIAN_SEED);
+    //    psRandom *r = psRandomAllocSpecific(PS_RANDOM_TAUS, p_psRandomGetSystemSeed());
+    psRandom *r = psRandomAllocSpecific(PS_RANDOM_TAUS, PS_XXX_GAUSSIAN_SEED);
     psVector* gauss = psVectorAlloc(Npts, PS_TYPE_F32);
     for (unsigned int i = 0; i < Npts; i++) {
Index: trunk/psLib/test/math/tap_psStats09.c
===================================================================
--- trunk/psLib/test/math/tap_psStats09.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psStats09.c	(revision 23259)
@@ -52,5 +52,5 @@
     srand(SEED);
 
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     psVector *truth = psVectorAlloc(numData, PS_TYPE_F64);
     for (long i = 0; i < numData; i++) {
Index: trunk/psLib/test/math/tap_psStatsTiming.c
===================================================================
--- trunk/psLib/test/math/tap_psStatsTiming.c	(revision 23231)
+++ trunk/psLib/test/math/tap_psStatsTiming.c	(revision 23259)
@@ -20,5 +20,5 @@
 
     // build a gauss-deviate vector (mean = 0.0, sigma = 1.0) for tests
-    psRandom *seed = psRandomAlloc (PS_RANDOM_TAUS, 0);
+    psRandom *seed = psRandomAllocSpecific (PS_RANDOM_TAUS, 0);
     psVector *rnd = psVectorAlloc (1000, PS_TYPE_F32);
     for (int i = 0; i < rnd->n; i++) {
Index: trunk/psLib/test/math/tst_psMinimizeLMM.c
===================================================================
--- trunk/psLib/test/math/tst_psMinimizeLMM.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psMinimizeLMM.c	(revision 23259)
@@ -66,5 +66,5 @@
     psBool testStatus = true;
 
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
     psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
Index: trunk/psLib/test/math/tst_psPolyFit1D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit1D.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psPolyFit1D.c	(revision 23259)
@@ -101,5 +101,5 @@
     xTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using a known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = (flags & TS00_X_NULL) ? i : 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tst_psPolyFit2D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit2D.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psPolyFit2D.c	(revision 23259)
@@ -100,5 +100,5 @@
     yTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tst_psPolyFit3D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit3D.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psPolyFit3D.c	(revision 23259)
@@ -103,5 +103,5 @@
     zTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tst_psPolyFit4D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 23259)
@@ -124,5 +124,5 @@
     tTruth->n = numData;
     fTruth->n = numData;
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
     for (int i = 0; i < numData; i++) {
         xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
Index: trunk/psLib/test/math/tst_psRandom.c
===================================================================
--- trunk/psLib/test/math/tst_psRandom.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psRandom.c	(revision 23259)
@@ -3,5 +3,5 @@
 work properly.
  
-    t00(): ensure that psRandom structs are properly allocated by psRandomAlloc().
+    t00(): ensure that psRandom structs are properly allocated by psRandomAllocSpecific().
     t01(): ensure that psRandomUniform() produces a sequence of numbers with
     proper mean and stdev.
@@ -45,5 +45,5 @@
 
 testDescription tests[] = {
-                              {testRandomAlloc,000,"psRandomAlloc",0,false},
+                              {testRandomAlloc,000,"psRandomAllocSpecific",0,false},
                               {testRandomUniform,000,"psRandomUniform",0,false},
                               {testRandomGaussian,000,"psRandomGaussian",0,false},
@@ -70,5 +70,5 @@
 
     // Valid type allocation
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
@@ -85,5 +85,5 @@
     //    psLogSetDestination("file:seed_msglog1.txt");
     psLogSetDestination(fd1);
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, 0);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, 0);
     //    psLogSetDestination("dest:stderr");
     psLogSetDestination(2);
@@ -100,5 +100,5 @@
     // Invalid type allocation
     psLogMsg(__func__,PS_LOG_INFO,"Invalid type, should generate error message");
-    myRNG = psRandomAlloc(100,SEED);
+    myRNG = psRandomAllocSpecific(100,SEED);
     if (myRNG != NULL) {
         psError(PS_ERR_UNKNOWN,true,"Did not return NULL for invalid type");
@@ -107,5 +107,5 @@
 
     // Negative seed value
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS,-5);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS,-5);
     if(myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Did not return allocated psRandom");
@@ -125,5 +125,5 @@
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
 
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
@@ -171,5 +171,5 @@
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
 
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
@@ -219,5 +219,5 @@
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
 
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
@@ -268,5 +268,5 @@
     rans02->n = rans02->nalloc;
 
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
@@ -302,5 +302,5 @@
 
     psRandom *myRNG1 = NULL;
-    myRNG1 = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG1 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     //    psLogSetDestination("dest:stderr");
     psLogSetDestination(0);
@@ -326,5 +326,5 @@
     rans02->n = rans02->nalloc;
 
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
@@ -372,5 +372,5 @@
     rans02->n = rans02->nalloc;
 
-    myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     if (myRNG == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
Index: trunk/psLib/test/math/tst_psStats09.c
===================================================================
--- trunk/psLib/test/math/tst_psStats09.c	(revision 23231)
+++ trunk/psLib/test/math/tst_psStats09.c	(revision 23259)
@@ -52,5 +52,5 @@
     printPositiveTestHeader(stdout, "psMathUtils functions", "psVectorStats Clipped Stats Routine");
 
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     psVector *truth = psVectorAlloc(numData, PS_TYPE_F64);
     truth->n = numData;
Index: trunk/psLib/test/mathtypes/tap_psVectorSelect.c
===================================================================
--- trunk/psLib/test/mathtypes/tap_psVectorSelect.c	(revision 23231)
+++ trunk/psLib/test/mathtypes/tap_psVectorSelect.c	(revision 23259)
@@ -17,5 +17,5 @@
     psVector *vector = psVectorAlloc(size, PS_TYPE_F32);
     psVectorInit(vector, 0.0);
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 12345);
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 12345);
     for (long i = 0; i < numNonzero; i++) {
         long index = psRandomUniform(rng) * size;
@@ -52,5 +52,5 @@
     psVector *vector = psVectorAlloc(size, PS_TYPE_F32);
     psVectorInit(vector, 0.0);
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 12345);
+    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 12345);
     for (long i = 0; i < numNonzero; i++) {
         long index = psRandomUniform(rng) * size;
Index: trunk/psLib/test/types/tap_psTree.c
===================================================================
--- trunk/psLib/test/types/tap_psTree.c	(revision 23231)
+++ trunk/psLib/test/types/tap_psTree.c	(revision 23259)
@@ -16,5 +16,5 @@
         psVector *y = psVectorAlloc(NUM, PS_TYPE_F64);
 
-        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
+        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 0);
         for (int i = 0; i < NUM; i++) {
             x->data.F64[i] = 2.0 * psRandomUniform(rng) - 1.0;
