core/random: Rename random() -> random_range()
This prevents a conflict with C's stdlib.h. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
023bae737c
commit
cea50ae37f
|
@ -192,7 +192,7 @@ Track *Queue :: next()
|
|||
else if (_tracks.size() == 1)
|
||||
_cur = 0;
|
||||
else if (_flags & Q_RANDOM)
|
||||
_cur += random(1, _tracks.size() / 2);
|
||||
_cur += random_range(1, _tracks.size() / 2);
|
||||
else
|
||||
_cur++;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static inline void random_seed(unsigned int n)
|
|||
* @param max Maximum value that will be returned.
|
||||
* @return A random value where min <= value <= max.
|
||||
*/
|
||||
static inline unsigned int random(unsigned int min, unsigned int max)
|
||||
static inline unsigned int random_range(unsigned int min, unsigned int max)
|
||||
{
|
||||
if (min >= max)
|
||||
return min;
|
||||
|
|
|
@ -12,9 +12,9 @@ static void test_rng(unsigned int seed)
|
|||
|
||||
for (unsigned int i = 0; i <= 10; i++) {
|
||||
if (i <= seed)
|
||||
test_equal(random(seed, i), seed);
|
||||
test_equal(random_range(seed, i), seed);
|
||||
else
|
||||
test_equal(random(seed, i), seed + (i % (i - seed)));
|
||||
test_equal(random_range(seed, i), seed + (i % (i - seed)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue