Lines Matching full:limit
45 * 0,...,limit-1. (Precondition: limit > 0.)
61 static uint32 random_upto_makemask(uint32 limit) { in random_upto_makemask() argument
65 if ((limit & (mask >> i)) == limit) in random_upto_makemask()
70 static uint32 random_upto_internal(uint32 limit, uint32 mask) { in random_upto_internal() argument
74 } while (ret > limit); in random_upto_internal()
78 uint32 random_upto(uint32 limit) { in random_upto() argument
79 uint32 mask = random_upto_makemask(limit); in random_upto()
80 return random_upto_internal(limit, mask); in random_upto()
83 uint32 random_upto_biased(uint32 limit, int bias) { in random_upto_biased() argument
84 uint32 mask = random_upto_makemask(limit); in random_upto_biased()
86 uint32 ret = random_upto_internal(limit, mask); in random_upto_biased()
89 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
90 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
91 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
92 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
93 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
94 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
95 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()
96 tmp = random_upto_internal(limit, mask); if (tmp < ret) ret = tmp; in random_upto_biased()