1.4.3.5 _LIBQ_Q15Rand Function
Generate a _Q15 random number.
Description
_Q15 _LIBQ_Q15Rand (int64_t *pSeed);
Generates a _Q15 pseudo-random value based on the seed supplied as a parameter. The first time this function is called, the seed value must be supplied by the user; this initial seed value can either be constant or random, depending on whether the user wants to generate a repeatable or a non-repeatable pseudo-random sequence.
The function updates the *pSeed value each time it is called. The updated *pSeed value must be passed back to the function with each subsequent call.
Warning: The pseudo-random sequence generated by this function may be insufficient for cryptographic use.
Preconditions
None.
Parameters
pSeed A pointer to the seed value used by the function to generate a pseudo-random sequence.
Returns
_LIBQ_Q15Rand returns a random _Q15 value.
_LIBQ_Q15Rand also updates the int64_t *pSeed value.
Remarks
Execution Time (cycles): 32
Program Memory 92 bytes
Example
_// Initialize seed to a constant or random value_
static int64_t randomSeed = 0xA71078BE72D4C1F1;
_Q15 randomValue;
randomValue = _LIBQ_Q15Rand(&randomSeed);
...
randomValue = _LIBQ_Q15Rand(&randomSeed);
C
_Q15 _LIBQ_Q15Rand (int64_t * pSeed );