#Random code generator
proc(_codegen, @codelength, @codetype, @codetype2,
#version 1.1
#How to use:
# call _codegen(NUMBER, type 1, type 2)
# The number determines how long the code is, and the 2 types determine which types of characters you want.
# Accepted types are lower (lowercase), upper (UPPERCASE), number (numbers), & full (lower, upper, and number)
#checks
if(@codelength == '',
)
if(@codetype == '',
)
#the characters
assign(@lower, array(a
,b
,c
,d
,e
,f
,g
,h
,i
,j
,k
,l
,m
,n
,o
,p
,q
,r
,s
,t
,u
,v
,w
,x
,y
,z
))
assign(@upper, array(A
,B
,C
,D
,E
,F
,G
,H
,I
,J
,K
,L
,M
,N
,O
,P
,Q
,R
,S
,T
,U
,V
,W
,X
,Y
,Z
))
assign(@full, array(a
,b
,c
,d
,e
,f
,g
,h
,i
,j
,k
,l
,m
,n
,o
,p
,q
,r
,s
,t
,u
,v
,w
,x
,y
,z
,A
,B
,C
,D
,E
,F
,G
,H
,I
,J
,K
,L
,M
,N
,O
,P
,Q
,R
,S
,T
,U
,V
,W
,X
,Y
,Z
,1,2,3,4,5,6,7,8,9))
#set 1
switch(@codetype,
'lower',
'upper',
'number',
'full',
die('Fail: Invalid code type given')
)
#set 2
if(@codetype2 !== '',
switch(@codetype2,
'lower',
'upper',
'number',
'full',
die('Fail: Invalid code type given')
)
foreach(@chars2, @i,
)
)
#generating code
for(assign(@i, 0), @i < @codelength, @i++
,
)
)
Language: commandhelper
Posted by extradessert at 25 Sep 2012, 04:16:50 UTC