summaryrefslogtreecommitdiff
path: root/src/librandom/random_name_from.c
blob: c9df29ef69293c09f9bdd3947c3b5b95d226db25 (plain)
1
2
3
4
5
6
7
8
9
10
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] ;
}