Rename rand64() to _rand64()

This commit is contained in:
Justine Tunney 2022-10-10 04:12:06 -07:00
parent c424352a0a
commit 7ae556463a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
52 changed files with 141 additions and 139 deletions

View file

@ -98,4 +98,4 @@ M(1, f, "fpclassify", Fpclassify, fpclassify(x),
"nan=0,inf=1,zero=2,subnorm=3,normal=4")
M(0, i, "rand", Rand, rand(), "deterministic random number")
M(0, i, "rand64", Rand64, rand64(), "64-bit random number")
M(0, i, "rand64", _Rand64, _rand64(), "64-bit random number")

View file

@ -70,7 +70,7 @@ void UdpClient(void) {
CHECK_NE(-1, (sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)));
CHECK_NE(-1, connect(sock, &addr, addrsize));
for (;;) {
rngset(buf, sizeof(buf), rand64, -1);
rngset(buf, sizeof(buf), _rand64, -1);
CHECK_NE(-1, write(sock, &addr, addrsize));
}
}
@ -106,7 +106,7 @@ void TcpClient(void) {
CHECK_NE(-1, (sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)));
CHECK_NE(-1, connect(sock, &addr, addrsize));
for (;;) {
rngset(buf, sizeof(buf), rand64, -1);
rngset(buf, sizeof(buf), _rand64, -1);
CHECK_NE(-1, write(sock, buf, sizeof(buf)));
CHECK_NE(-1, read(sock, buf, sizeof(buf)));
}

View file

@ -150,7 +150,7 @@ int LuaLemur64(lua_State *L) {
}
int LuaRand64(lua_State *L) {
return LuaRand(L, rand64);
return LuaRand(L, _rand64);
}
int LuaRdrand(lua_State *L) {

View file

@ -2611,7 +2611,7 @@ static char *ServeAssetCompressed(struct Asset *a) {
dg.i = 0;
dg.c = 0;
if (usingssl) {
dg.z = 512 + (rand64() & 1023);
dg.z = 512 + (_rand64() & 1023);
} else {
dg.z = 65536;
}

View file

@ -16,19 +16,19 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/gc.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/lcg.internal.h"
#include "libc/stdio/rand.h"
#include "libc/mem/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/ex.h"
@ -184,7 +184,7 @@ void GetOpts(int argc, char *argv[]) {
want_double = true;
break;
case 'g':
rand_ = rand64;
rand_ = _rand64;
break;
case 'N':
name_ = optarg;

View file

@ -414,8 +414,8 @@ static void OnMouseLeftDrag(long y, long x) {
save_x = x;
y = top + (y << (zoom + !!zoom));
x = left + (x << zoom);
y += rand64() & ((1ul << (zoom + !!zoom)) - 1);
x += rand64() & ((1ul << zoom) - 1);
y += _rand64() & ((1ul << (zoom + !!zoom)) - 1);
x += _rand64() & ((1ul << zoom) - 1);
if (y < 0 || y >= byn) return;
if (x < 0 || x >= bxn) return;
if (erase) {
@ -819,7 +819,7 @@ static void Rando1(void) {
long i, n;
n = (byn * bxn) >> 6;
for (i = 0; i < n; ++i) {
board[i] = rand64();
board[i] = _rand64();
}
}