Advertisement
krot

rand_string

Oct 28th, 2023
1,505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.18 KB | None | 0 0
  1. rand_string(0,Acc)->Acc;
  2. rand_string(Len,Acc)->
  3. Ch = case  rand:uniform(2) of
  4.     1->
  5.         $/+rand:uniform(10);
  6.     _->$@+rand:uniform(26)
  7. end,
  8. rand_string(Len-1,[Ch|Acc]).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement