The old code uses rejection sampling. Trying to get number between 0~61 from 0~RAND_MAX (on Windows this is 15bits and on Linux 32bits) is extremely slow. This patch fixes that by using C++'s distribution class.
Also replaces rand() with C++ random engines since OpenBSD is complaining about it.
ld: warning: Utilities.cc(Utilities.cc.o:(drogon::utils::genRandomString(int)) in archive ../libdrogon.a): warning: rand() may return deterministic values, is that what you want?
The old code uses rejection sampling. Trying to get number between 0~61 from 0~RAND_MAX (on Windows this is 15bits and on Linux 32bits) is extremely slow. This patch fixes that by using C++'s distribution class.
Also replaces rand() with C++ random engines since OpenBSD is complaining about it.