Make me a password generator! I am making a customizable password generator.

But I (for some reason) thought it'd be better to let you guys do it.



Umm.. then?

You only get one integer. That will include all the information about the customization.

The first 4 bits (1,2,4,8) will be used for choosing which charsets will be used.

Each bit corresponds to:

1: Lowercase alphabet(qwertyuiopasdfghjklzxcvbnm)

2: Uppercase alphabet(QWERTYUIOPASDFGHJKLZXCVBNM)

4: Numbers(0123456789)

8: Special chars(All printable characters except ones stated above and the space)

The length of the password will be shifted 4 bits. In other words, multiplied by 16.

Then generate the password with the charsets and the length.

Examples

175 (10*16 + 15 (1111)): a_U0!/h96%
Python 2, 217 203 bytes

from random import*
r=[10]+range(33,127)
r=[r[65:91],r[33:59],r[16:26],r[:16]+r[26:33]+r[59:65]+r[91:]]
x=input()
l=x&gt;&gt;4
print''.join(map(chr,sample(sum([k[1]for k in enumerate(r)if x&amp;2**k[0]],[])*l,l)))


Ugh this is horribly long. The part I think could be golfed the most is the part to get the charsets; that part was a pain.

By the way, I am @HyperNeutrino; I'm just getting enough rep to chat. :P

-14 bytes thanks @ValueInk!
Bug fix thanks to @ovs!