diff options
Diffstat (limited to 'src/librandom/random_name_from.c')
| -rw-r--r-- | src/librandom/random_name_from.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librandom/random_name_from.c b/src/librandom/random_name_from.c new file mode 100644 index 0000000..c9df29e --- /dev/null +++ b/src/librandom/random_name_from.c @@ -0,0 +1,11 @@ +/* ISC license. */ + +#include <skalibs/functypes.h> +#include <skalibs/random.h> + +void random_name_from (char *s, size_t n, randomgen_func_ref f) +{ + static char const random_oklist[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ; + (*f)(s, n) ; + while (n--) s[n] = random_oklist[s[n] & 63] ; +} |
