-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (39 loc) · 921 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function jumble(s)
{
var z="";
while(s.length > 0)
{
var index = Math.floor(Math.random() * s.length);
var c = s.charAt(index);
z =z+ s.charAt(index);
s=s.substring(0, index) + s.substring(index + 1);
}
return z;
}
function main(chars,cap,small,numbers)
{
var x="!@#$%^&*()_+=-[]{}|;':,./<>?`~";
var y="abcdefghijklmnopqrstuvwxyz";
var z="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var w="0123456789";
var s="";
for(var i=0;i<chars;i++)
{
s+=x.charAt(Math.floor(Math.random()*x.length));
}
for(var i=0;i<cap;i++)
{
s+=y.charAt(Math.floor(Math.random()*y.length));
}
for(var i=0;i<small;i++)
{
s+=z.charAt(Math.floor(Math.random()*z.length));
}
for(var i=0;i<numbers;i++)
{
s+=w.charAt(Math.floor(Math.random()*w.length));
}
var z=jumble(s);
return z;
}
module.exports=main;