IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 24, 2004, 11:59:43 AM (22 years ago)
Author:
gusciora
Message:

Changed the order of the arguments for the polynomial eval functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psRandom.c

    r2432 r2433  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-11-24 20:55:01 $
     12*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-11-24 21:59:43 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <float.h>
    2121#include <math.h>
     22#include <gsl/gsl_rng.h>
     23#include <gsl/gsl_randist.h>
    2224
     25#include "psMemory.h"
    2326#include "psRandom.h"
    2427#include "psScalar.h"
     28#include "psError.h"
     29#include "psTrace.h"
     30#include "psLogMsg.h"
     31#include "psConstants.h"
     32#include "psDataManipErrors.h"
    2533
    2634/*
     
    3947                        psU64 seed)
    4048{
     49    gsl_rng *r = NULL;
     50    psRandom *myRNG = (psRandom *) psAlloc(sizeof(psRandom));
     51
     52    switch (type) {
     53    case PS_RANDOM_TAUS:
     54        r = gsl_rng_alloc(gsl_rng_taus);
     55        myRNG->gsl = r;
     56        return(myRNG);
     57
     58    default:
     59        psError(PS_ERR_UNEXPECTED_NULL,
     60                true,
     61                PS_ERRORTEXT_psRandom_UNKNOWN_RANDFOM_NUMBER_GENERATOR_TYPE);
     62    }
    4163    return(NULL);
    4264}
     
    4466void psRandomReset(psRandom *rand,
    4567                   psU64 seed)
    46 {}
     68{
     69    gsl_rng_set(rand->gsl, seed);
     70}
    4771
    4872psF64 psRandomUniform(const psRandom *r)
    4973{
    50     return(0.0);
     74    return(gsl_rng_uniform(r->gsl));
    5175}
    5276
    5377psF64 psRandomGaussian(const psRandom *r)
    5478{
    55     return(0.0);
     79    // XXX: What should sigma be?
     80    return(gsl_ran_gaussian(r->gsl, 1.0));
    5681}
    5782
    5883psF64 psRandomPoisson(const psRandom *r, psF64 mean)
    5984{
    60     return(0.0);
     85    return((psF64) gsl_ran_poisson(r->gsl, mean));
    6186}
Note: See TracChangeset for help on using the changeset viewer.