/* ** ** Function: random_number() ** ** Description: returns a number randomly taken in [0, n] ** with np1 = n+1 at input ** ** Links to text: ** ** Arguments: ** ** Word16 np1 ** Word16 *nRandom random generator status (input/output) ** ** Outputs: ** ** Word16 *nRandom ** ** Return value: random number in [0, (np1-1)] ** */ Word16 random_number(Word16 np1, Word16 *nRandom) { Word16 temp; temp = Rand_lbc(nRandom) & (Word16)0x7FFF; temp = mult(temp, np1); return(temp); }
/* ** ** Function: random_number() ** ** Description: returns a number randomly taken in [0, n] ** with np1 = n+1 at input ** ** Links to text: ** ** Arguments: ** ** int16_t np1 ** int16_t *nRandom random generator status (input/output) ** ** Outputs: ** ** int16_t *nRandom ** ** Return value: random number in [0, (np1-1)] ** */ int16_t random_number(int16_t np1, int16_t * nRandom) { int16_t temp; temp = Rand_lbc(nRandom) & (int16_t) 0x7FFF; temp = g723_mult(temp, np1); return (temp); }