Woolz Image Processing  Version 1.8.3
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

◆ AlgRandSeed()

void AlgRandSeed ( long  seed)

Seeds the pseudo-random number generators.

Returns
void
Parameters
seedGiven seed value.

Referenced by WlzBasisFnTransformRandom(), WlzGaussNoise(), and WlzGreySetRange().

◆ AlgRandUniform()

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 AlgRandNormal(), AlgRandZigNormal(), WlzBasisFnTransformRandom(), WlzPointsDither(), WlzPointsFromDomObj(), and WlzValueDitherI().

◆ AlgRandNormal()

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 WlzGaussNoise().

◆ AlgRandZigNormal()

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 WlzGreySetRange().

◆ AlgShuffleIdx()

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 WlzBasisFnTransformRandom(), WlzPointsFromDomObj(), WlzSnapFit(), and WlzVerticesBuildTree().