Clock component removed from 'luaL_makeseed'

'clock' can be quite slow on some machines.
This commit is contained in:
Roberto Ierusalimschy
2023-03-23 16:01:16 -03:00
parent 5a04f1851e
commit 86e8039a72
4 changed files with 9 additions and 11 deletions

View File

@@ -310,7 +310,7 @@ static IdxT partition (lua_State *L, IdxT lo, IdxT up) {
*/
static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) {
IdxT r4 = (up - lo) / 4; /* range/4 */
IdxT p = rnd % (r4 * 2) + (lo + r4);
IdxT p = (rnd ^ lo ^ up) % (r4 * 2) + (lo + r4);
lua_assert(lo + r4 <= p && p <= up - r4);
return p;
}