2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_RAND_RAND_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_RAND_RAND_H_
|
2021-09-28 05:58:51 +00:00
|
|
|
#define RAND_MAX __INT_MAX__
|
2020-06-15 14:18:57 +00:00
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
|
|
|
│ cosmopolitan § random ─╬─│┼
|
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
|
2021-09-28 05:58:51 +00:00
|
|
|
int rand(void);
|
2022-10-11 00:52:41 +00:00
|
|
|
void srand(unsigned);
|
2020-06-15 14:18:57 +00:00
|
|
|
char *strfry(char *);
|
|
|
|
int getentropy(void *, size_t);
|
|
|
|
ssize_t getrandom(void *, size_t, unsigned);
|
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);
|
2021-09-28 05:58:51 +00:00
|
|
|
|
2023-08-14 03:31:27 +00:00
|
|
|
#ifdef _COSMO_SOURCE
|
2023-06-06 10:30:37 +00:00
|
|
|
#define vigna __vigna
|
|
|
|
#define vigna_r __vigna_r
|
|
|
|
#define rngset __rngset
|
|
|
|
#define rdrand __rdrand
|
|
|
|
#define rdseed __rdseed
|
2023-08-12 05:52:11 +00:00
|
|
|
double poz(double);
|
|
|
|
double pochisq(double, int);
|
2022-04-07 07:15:35 +00:00
|
|
|
uint64_t lemur64(void);
|
2022-10-10 11:12:06 +00:00
|
|
|
uint64_t _rand64(void);
|
2021-09-28 05:58:51 +00:00
|
|
|
uint64_t vigna(void);
|
|
|
|
uint64_t vigna_r(uint64_t[hasatleast 1]);
|
|
|
|
void svigna(uint64_t);
|
|
|
|
uint64_t rdrand(void);
|
|
|
|
uint64_t rdseed(void);
|
|
|
|
void _smt19937(uint64_t);
|
|
|
|
void _Smt19937(uint64_t[], size_t);
|
|
|
|
uint64_t _mt19937(void);
|
|
|
|
double _real1(uint64_t);
|
|
|
|
double _real2(uint64_t);
|
|
|
|
double _real3(uint64_t);
|
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);
|
2021-09-28 05:58:51 +00:00
|
|
|
void *rngset(void *, size_t, uint64_t (*)(void), size_t);
|
2023-08-12 05:52:11 +00:00
|
|
|
void rt_init(int);
|
|
|
|
void rt_add(void *, int);
|
|
|
|
void rt_end(double *, double *, double *, double *, double *);
|
2023-08-14 03:31:27 +00:00
|
|
|
#endif /* _COSMO_SOURCE */
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_RAND_RAND_H_ */
|