2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_RAND_RAND_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_RAND_RAND_H_
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
|
|
|
│ cosmopolitan § random ─╬─│┼
|
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
|
2021-06-24 19:31:26 +00:00
|
|
|
#define RAND_MAX __INT_MAX__
|
|
|
|
void srand(uint64_t) nothrow nocallback;
|
|
|
|
int rand(void) nothrow nocallback;
|
|
|
|
uint64_t rand64(void) nothrow nocallback;
|
|
|
|
double poz(double);
|
2020-06-15 14:18:57 +00:00
|
|
|
double pochisq(double, int);
|
|
|
|
void rt_init(int);
|
|
|
|
void rt_add(void *, int);
|
|
|
|
void rt_end(double *, double *, double *, double *, double *);
|
|
|
|
void *rngset(void *, size_t, uint64_t (*)(void), size_t) paramsnonnull();
|
|
|
|
char *strfry(char *);
|
|
|
|
int getentropy(void *, size_t);
|
|
|
|
ssize_t getrandom(void *, size_t, unsigned);
|
|
|
|
uint64_t rdrand(void);
|
2020-11-25 16:19:00 +00:00
|
|
|
uint64_t rdseed(void);
|
2020-06-15 14:18:57 +00:00
|
|
|
float randf(void);
|
2021-03-14 04:24:29 +00:00
|
|
|
char *initstate(unsigned, char *, size_t);
|
|
|
|
char *setstate(char *);
|
|
|
|
long random(void);
|
2021-03-21 14:33:33 +00:00
|
|
|
void srandom(unsigned);
|
Make improvements to redbean
The following Lua APIs have been added:
- IsDaemon() → bool
- ProgramPidPath(str)
The following Lua hooks have been added:
- OnClientConnection(ip:int,port:int,serverip:int,serverport:int) → bool
- OnProcessCreate(pid:int,ip:int,port:int,serverip:int,serverport:int)
- OnProcessDestroy(pid:int)
- OnServerStart()
- OnServerStop()
- OnWorkerStart()
- OnWorkerStop()
redbean now does a better job at applying gzip on the fly from the local
filesystem, using a streaming chunked api with constant memory, which is
useful for doing things like serving a 4gb text file off NFS, and having
it start transmitting in milliseconds. redbean will also compute entropy
on the beginnings of files to determine if compression is profitable.
This change pays off technical debts relating to memory, such as relying
on exit() to free() allocations. That's now mostly fixed so it should be
easier now to spot memory leaks in malloc traces.
This change also fixes bugs and makes improvements to our SSL support.
Uniprocess mode failed handshakes are no longer an issue. Token Alpn is
offered so curl -v looks less weird. Hybrid SSL certificate loading is
now smarter about naming conflicts. Self-signed CA root anchors will no
longer be delivered to the client during the handshake.
2021-07-10 22:02:03 +00:00
|
|
|
double MeasureEntropy(const char *, size_t);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_RAND_RAND_H_ */
|