Unix
Mac OS X
Windows
Options
Unix
Windows

# Module random Methods

## AcquireRandomInfo

AcquireRandomInfo() allocates the RandomInfo structure.

The format of the AcquireRandomInfo method is:

      RandomInfo *AcquireRandomInfo(const RandomType hash)

A description of each parameter follows:

##### hash

the hash type.

## GetEntropyFromReservoir

GetEntropyFromReservoir() gets entropy from the random reservoir on disk.

The format of the GetEntropyFromReservoir method is:

      StringInfo *GetEntropyFromReservoir(RandomInfo *random_info,
        ExceptionInfo *exception)

A description of each parameter follows:

##### random_info

the random reservoir info.

##### exception

Return any errors or warnings in this structure.

## GetPseudoRandomValue

GetPseudoRandomValue() return a non-negative size_t value uniformly distributed over the interval [0.0, 1.0) with a 2 to the 128th-1 period.

The format of the GetPseudoRandomValue method is:

      double GetPseudoRandomValue(RandomInfo *randon_info)

A description of each parameter follows:

##### random_info

the random info.

## GetRandomKey

GetRandomKey() gets a random key from the reservoir.

The format of the GetRandomKey method is:

      StringInfo *GetRandomKey(RandomInfo *random_info,const size_t length)

A description of each parameter follows:

##### random_info

the random info.

##### length

the key length.

## GetRandomValue

GetRandomValue() return a non-negative double-precision floating-point value uniformly distributed over the interval [0.0, 1.0) with a 2 to the 128th-1 period (not cryptographically strong).

The format of the GetRandomValue method is:

      double GetRandomValue(void)

## SaveEntropyToReservoir

SaveEntropyToReservoir() saves entropy to the reservior on disk.

The format of the SaveEntropyToReservoir method is:

      WizardBooleanType SaveEntropyToReservoir(RandomInfo *random_info,
        ExceptionInfo *exception)

A description of each parameter follows:

##### random_info

the random info.

##### exception

Return any errors or warnings in this structure.

## SeedPseudoRandomGenerator

SeedPseudoRandomGenerator() initializes the pseudo-random number generator with a random seed.

The format of the SeedPseudoRandomGenerator method is:

      void SeedPseudoRandomGenerator(const size_t seed)

A description of each parameter follows:

##### seed

the seed.

## SetRandomKey

SetRandomKey() sets a random key from the reservoir.

The format of the SetRandomKey method is:

      void SetRandomKey(RandomInfo *random_info,const size_t length,
        unsigned char *key)

A description of each parameter follows:

##### random_info

the random info.

##### length

the key length.

##### key

the key.

## SetRandomTrueRandom

SetRandomTrueRandom() declares your intentions to use true random numbers. True random numbers are encouraged but may not always be practical because your application may block while entropy is gathered from your environment.

The format of the SetRandomTrueRandom method is:

      void SetRandomTrueRandom(const WizardBooleanType true_random)

A description of each parameter follows:

##### true_random

declare your intentions to use true-random number.

Discourse Server