Woolz Image Processing  Version 1.7.0
AlgRand

Files

file  AlgRand.c
 Provides functions which produce pseudo-random values.
 
file  AlgRandZig.c
 The Gaussian distribution random number generator is based on the Ziggurat method for generating random variables as used in the GNU scientific library. For details of the Ziggurat method see: George Marsaglia, Wai Wan Tsang The Ziggurat Method for Generating Random Variables, Journal of Statistical Software, vol. 5 (2000), no. 8 (http://www.jstatsoft.org/v05/i08/).
 
file  AlgShuffle.c
 Functions for randomly permuting data.
 

Functions

void AlgRandSeed (long seed)
 Seeds the pseudo-random number generators. More...
 
double AlgRandUniform (void)
 Produces a pseudo-random value from a uniform distribution over the interval [0.0, 1.0]. More...
 
double AlgRandNormal (double mu, double sigma)
 Produces a pseudo-random value from a normal distribution over the interval [-1.0, 1.0]. More...
 
double AlgRandZigNormal (double mu, double sigma)
 Generates a random double from a gaussian distribution the Ziggurat method. The distribution generated by this function is not quite as smooth as that generated by AlgRandNormal() but the time taken is a factor of ten smaller. More...
 
AlgError AlgShuffleIdx (int nShuffle, int *shuffle, int seed)
 Inserts indicies into the given array which can be used to shuffle data. The permuted indicies are in the range [0-(nShuffle-1)] with a random order. This shuffling algorithm is based on a published paper! Dursenfeld R. "Random Permutation" CACM July 1964 No 7 p420. More...
 

Detailed Description

Function Documentation

void AlgRandSeed ( long  seed)

Seeds the pseudo-random number generators.

Returns
void
Parameters
seedGiven seed value.

Referenced by AlcHeapTop(), WlzCMeshStrainTensorAtPts(), WlzGaussNoise(), and WlzGreySetRange().

double AlgRandUniform ( void  )

Produces a pseudo-random value from a uniform distribution over the interval [0.0, 1.0].

Returns
Pseudo-random value.

Referenced by AlcHeapTop(), AlgRandNormal(), AlgRandZigNormal(), WlzContourRBFBndObj3D(), WlzMatchICPWeightMatches(), WlzPointsDither(), WlzPointsFromDomObj(), and WlzValueDitherI().

double AlgRandNormal ( double  mu,
double  sigma 
)

Produces a pseudo-random value from a normal distribution over the interval [-1.0, 1.0].

Returns
Pseudo-random value.
Parameters
muMean of distribution.
sigmaStandard deviation of distribution.

References AlgRandUniform().

Referenced by WlzCutObjToValBox3D(), and WlzGaussNoise().

double AlgRandZigNormal ( double  mu,
double  sigma 
)

Generates a random double from a gaussian distribution the Ziggurat method. The distribution generated by this function is not quite as smooth as that generated by AlgRandNormal() but the time taken is a factor of ten smaller.

Returns
Random double from gaussian distribution.
Parameters
muMean of distribution.
sigmaStandard deviation of distribution.

References AlgRandUniform().

Referenced by WlzCMeshStrainTensorAtPts(), and WlzGreySetRange().

AlgError AlgShuffleIdx ( int  nShuffle,
int *  shuffle,
int  seed 
)

Inserts indicies into the given array which can be used to shuffle data. The permuted indicies are in the range [0-(nShuffle-1)] with a random order. This shuffling algorithm is based on a published paper! Dursenfeld R. "Random Permutation" CACM July 1964 No 7 p420.

Returns
Error code.
Parameters
nShuffleNumber of permuted indicies to insert into in shuffle.
shuffleArray into which shuffled indicies are placed.
seedSeed fro random permutation.

References ALG_ERR_FUNC, and ALG_ERR_NONE.

Referenced by WlzContourRBFBndObj3D(), WlzPointsFromDomObj(), WlzSnapFit(), and WlzVerticesBuildTree().