blob: 5e77e837645e30d51a7f07af0c03ab83cdaa139a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
/* ISC license. */
#include <skalibs/unirandom.h>
#include <skalibs/rrandom.h>
unsigned int rrandom_name (rrandom_ref z, char *s, unsigned int n, int nb)
{
static char const *oklist = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ;
register unsigned int r = rrandom_read(z, s, n, nb ? &unirandom_readnb : &unirandom_readb) ;
register unsigned int i = 0 ;
for (; i < r ; i++) s[i] = oklist[s[i] & 63] ;
return r ;
}
|