1 USING: math math.ranges arrays sequences kernel random splitting
5 : >Upper ( str -- str )
6 dup empty? [ unclip ch>upper prefix ] unless ;
8 : >Upper-dashes ( str -- str )
9 "-" split [ >Upper ] map "-" join ;
11 : lower-alpha-chars ( -- seq )
12 CHAR: a CHAR: z [a,b] ;
14 : upper-alpha-chars ( -- seq )
15 CHAR: A CHAR: Z [a,b] ;
17 : numeric-chars ( -- seq )
18 CHAR: 0 CHAR: 9 [a,b] ;
20 : alpha-chars ( -- seq )
21 lower-alpha-chars upper-alpha-chars append ;
23 : alphanumeric-chars ( -- seq )
24 alpha-chars numeric-chars append ;
26 : random-alpha-char ( -- ch )
29 : random-alphanumeric-char ( -- ch )
30 alphanumeric-chars random ;
32 : random-alphanumeric-string ( length -- str )
33 [ random-alphanumeric-char ] "" replicate-as ;