pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
Typedefs | Functions
Plank RNG class
Plank classes

A simple, fast, cross-platform random number generator. More...

Typedefs

typedef struct PlankRNG * PlankRNGRef
 An opaque reference to the Plank RNG object.

Functions

PlankRNGRef pl_RNG_CreateAndInit ()
 Create and initialise a Plank RNG object and return an oqaque reference to it.
PlankRNGRef pl_RNG_Create ()
 Create a Plank RNG object and return an oqaque reference to it.
PlankResult pl_RNG_Init (PlankRNGRef p)
 Initialse a Plank RNG object.
PlankResult pl_RNG_DeInit (PlankRNGRef p)
 Deinitialse a Plank RNG object.
PlankResult pl_RNG_Destroy (PlankRNGRef p)
 Destroy a Plank RNG object.
void pl_RNG_Seed (PlankRNGRef p, unsigned int seed)
 Seed a Plank RNG object.
static int pl_RNG_Next (PlankRNGRef p)
 Generate a random integer.
static unsigned int pl_RNG_NextInt (PlankRNGRef p, unsigned int max)
 Generate a random unsigned integer over a given range.
static float pl_RNG_NextFloat (PlankRNGRef p)
 Generate a random float between 0 and 1.
static double pl_RNG_NextDouble (PlankRNGRef p)
 Generate a random double between 0 and 1.

Detailed Description

A simple, fast, cross-platform random number generator.

The following code snippet creates a Plank RNG object, generates a random float, then destroys the Plank RNG object.

 PlankRNGRef rng;
 float value;
 rng = pl_RNG_CreateAndInit();
 value = pl_RNG_NextFloat (rng);
 pl_RNG_Destroy (rng);

Typedef Documentation

typedef struct PlankRNG* PlankRNGRef

An opaque reference to the Plank RNG object.


Function Documentation

PlankRNGRef pl_RNG_Create ( )

Create a Plank RNG object and return an oqaque reference to it.

Returns:
A Plank RNG object as an opaque reference or NULL.
PlankRNGRef pl_RNG_CreateAndInit ( )

Create and initialise a Plank RNG object and return an oqaque reference to it.

Returns:
A Plank RNG object as an opaque reference or NULL.
PlankResult pl_RNG_DeInit ( PlankRNGRef  p)

Deinitialse a Plank RNG object.

Parameters:
pThe Plank RNG object.
Returns:
A result code which will be PlankResult_OK if the operation was completely successful.
PlankResult pl_RNG_Destroy ( PlankRNGRef  p)

Destroy a Plank RNG object.

Parameters:
pThe Plank RNG object.
Returns:
A result code which will be PlankResult_OK if the operation was completely successful.
PlankResult pl_RNG_Init ( PlankRNGRef  p)

Initialse a Plank RNG object.

Parameters:
pThe Plank RNG object.
Returns:
A result code which will be PlankResult_OK if the operation was completely successful.
static int pl_RNG_Next ( PlankRNGRef  p) [static]

Generate a random integer.

Parameters:
pThe Plank RNG object.
Returns:
The random integer.
static double pl_RNG_NextDouble ( PlankRNGRef  p) [static]

Generate a random double between 0 and 1.

Parameters:
pThe Plank RNG object.
Returns:
The random double.
static float pl_RNG_NextFloat ( PlankRNGRef  p) [static]

Generate a random float between 0 and 1.

Parameters:
pThe Plank RNG object.
Returns:
The random float.
static unsigned int pl_RNG_NextInt ( PlankRNGRef  p,
unsigned int  max 
) [static]

Generate a random unsigned integer over a given range.

Parameters:
pThe Plank RNG object.
maxRandom numbers between 0 and max-1 will be generated.
Returns:
The random unsigned integer.
void pl_RNG_Seed ( PlankRNGRef  p,
unsigned int  seed 
)

Seed a Plank RNG object.

Parameters:
pThe Plank RNG object.
seedThe new seed.
 All Classes Functions Typedefs Enumerations Enumerator Properties