mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +00:00
removed extra _rand64
This commit is contained in:
parent
dc5c795df3
commit
ad8f623320
1 changed files with 5 additions and 2 deletions
|
@ -839,14 +839,17 @@ int LuaUuidV4(lua_State *L) {
|
|||
r = _rand64();
|
||||
j = 0;
|
||||
}
|
||||
uuid_str[i] = v[(r & (0xfull << (j * 4ull))) >> (j * 4ull)];
|
||||
if (i == 19) {
|
||||
uuid_str[i] = v[8 + r % 4];
|
||||
} else {
|
||||
uuid_str[i] = v[(r & (0xfull << (j * 4ull))) >> (j * 4ull)];
|
||||
}
|
||||
}
|
||||
|
||||
uuid_str[8] = '-';
|
||||
uuid_str[13] = '-';
|
||||
uuid_str[14] = '4';
|
||||
uuid_str[18] = '-';
|
||||
uuid_str[19] = v[8 + _rand64() % 4];
|
||||
uuid_str[23] = '-';
|
||||
uuid_str[36] = '\0';
|
||||
lua_pushfstring(L, uuid_str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue