View difference between Paste ID: VruG3Qe3 and 8QDKd0Gr
SHOW: | | - or go back to the newest paste.
1
append = [$arg1 = (concat (getalias $arg1) $arg2)]
2
appendword = [$arg1 = (concatword (getalias $arg1) $arg2)]
3
clampval = [max $arg2 (min $arg3 $arg1)]
4
5
keygen = [
6-
	keychars = [ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890]
6+
	local chars tmp1 tmp2 tmp3
7-
	_str = "" ; _num = (? $arg1 (clampval $arg1 3 10) 5)
7+
	chars = [ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890]
8-
	loop i $_num [
8+
	tmp2 = (? $arg1 (clampval $arg1 3 10) 5)
9-
		loop p (? @arg2 (clampval @arg2 3 8) 4) [
9+
	tmp3 = (? $arg2 (clampval $arg2 3 8) 4)
10-
			appendword _str (substr $keychars (rnd (strlen $keychars)) 1)
10+
11
	loop i $tmp2 [
12-
		if (< $i (- $_num 1)) [append _str ""]
12+
		loop p $tmp3 [
13
			appendword tmp1 (substr $chars (rnd (strlen $chars)) 1)
14-
	say (strreplace $_str " " "-")
14+
15
		if (< $i (- $tmp2 1)) [append tmp1 ""]
16
	]
17
	say (strreplace $tmp1 " " "-")
18
]
19
20
// use /keygen <section amount> <section length>
21
// like, /keygen 6 5