22 lines
450 B
C
22 lines
450 B
C
#include "misc.h"
|
|
|
|
#include <blue/core/random.h>
|
|
|
|
void z__b_io_generate_tmp_filename(char *out, size_t len)
|
|
{
|
|
static const char *alphabet
|
|
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
|
"01234567"
|
|
"89+=-_.";
|
|
static const size_t alphabet_len = 67;
|
|
|
|
b_random_ctx *ctx = b_random_global_ctx();
|
|
|
|
for (size_t i = 0; i < len; i++) {
|
|
int v = b_random_next_int64(ctx) % alphabet_len;
|
|
out[i] = alphabet[v];
|
|
}
|
|
|
|
out[len - 1] = 0;
|
|
}
|