Changeset 4293 for trunk/psLib/src/dataManip/psRandom.h
- Timestamp:
- Jun 16, 2005, 2:11:08 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataManip/psRandom.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psRandom.h
r4162 r4293 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06- 08 23:40:45 $12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-17 00:11:05 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 33 33 */ 34 34 35 /** Enumeration containing a flag for psRandom types. */ 35 36 typedef enum { 36 PS_RANDOM_TAUS ///< A maximally equidistributed combined Tausworthe generator.37 PS_RANDOM_TAUS ///< A maximally equidistributed combined Tausworthe generator. 37 38 } psRandomType; 38 39 40 /** Data structure for psRandom. 41 * Contains information on the psRandom type and GNU Scientific Library random number generator. 42 */ 39 43 typedef struct 40 44 { 41 psRandomType type; ///< The type of RNG42 gsl_rng *gsl; ///< The RNG itself45 psRandomType type; ///< The type of RNG 46 gsl_rng *gsl; ///< The RNG itself 43 47 } 44 48 psRandom; 45 49 46 psRandom *psRandomAlloc(psRandomType type, 47 psU64 seed); 50 /** Allocates a psRandom struct. 51 * 52 * @return psRandom*: A new psRandom structure. 53 */ 54 psRandom *psRandomAlloc( 55 psRandomType type, ///< The type of RNG 56 psU64 seed ///< Known value with which to seed the RNG 57 ); 48 58 49 void psRandomReset(psRandom *rand, 50 psU64 seed); 59 /** Resets an existing psRandom struct. 60 * 61 * @return void 62 */ 63 void psRandomReset( 64 psRandom *rand, ///< Existing psRandom struct to reset 65 psU64 seed ///< Known value with which to seed the RNG 66 ); 51 67 52 psF64 psRandomUniform(const psRandom *r); 53 psF64 psRandomGaussian(const psRandom *r); 54 psF64 psRandomPoisson(const psRandom *r, psF64 mean); 68 /** Random number generator based on a uniform distribution on [0,1). 69 * Uses gsl_rng_uniform. 70 * 71 * @return psF64: Random number. 72 */ 73 psF64 psRandomUniform( 74 const psRandom *r ///< psRandom struct for RNG 75 ); 76 77 /** Random number generator based on a Gaussian deviate, N(0,1). 78 * Uses gsl_ran_gaussian. 79 * 80 * @return psF64: Random number. 81 */ 82 psF64 psRandomGaussian( 83 const psRandom *r ///< psRandom struct for RNG 84 ); 85 86 /** Random number generator based on a Poisson distribution with the given mean. 87 * Uses gsl_ran_poisson. 88 * 89 * @return psF64: Random number. 90 */ 91 psF64 psRandomPoisson( 92 const psRandom *r, ///< psRandom struct for RNG 93 psF64 mean ///< Mean value 94 ); 55 95 56 96 /* \} */// End of MathGroup Functions
Note:
See TracChangeset
for help on using the changeset viewer.
