I'm currently developing a CLI password generator and I've been trying to come up with ways of randomizing characters between a defined set of chars. I know the srand(time(NULL)) method, but as far as I know, it's a bit inconsistent and not so safe to generate random passwords.
I also know there is a way of randomizing numbers using the libsodium library for C (according to this topic), but I'm not sure how to use it. Should I install all the dependencies in my project? It is a relatively small project to have such a huge library. Although I plan on expanding it as time goes by, I don't know if it's worth having a huge library and not use most of its functions.
On top of that, are there specific algorithms to generate passwords other than just randomizing characters? Should I also randomize the array within itself following another algorithm for better consistency, like the Fisher Yates Shuffle?
rand()function has only one seed used by all threads — so independent sequences are not feasible.drand48()family of functions provides some which have independent seeds, so you can have different sequences depending on which seed values you use. And theprng48_*()family of functions exploitsnrand48()because it takes a user-specified seed. Getting a good, random enough, initial value for the seed is a whole separate bag of worms.drand48()differs fromdev/randomordev/urandom? Also, how could I implement the solutions you mentioned in your repository on my project? What libraries would I have to use?