* @brief Generates a random password from the given charset. * @param charset Characters to use in the password * @param length Desired password length * @return Generated password string */
| 877 | * @return Generated password string |
| 878 | */ |
| 879 | auto Pass::generateRandomPassword(const QString &charset, unsigned int length) |
| 880 | -> QString { |
| 881 | if (charset.isEmpty() || length == 0U) { |
| 882 | return {}; |
| 883 | } |
| 884 | QString out; |
| 885 | for (unsigned int i = 0; i < length; ++i) { |
| 886 | out.append(charset.at(static_cast<int>( |
| 887 | boundedRandom(static_cast<quint32>(charset.length()))))); |
| 888 | } |
| 889 | return out; |
| 890 | } |
nothing calls this directly
no outgoing calls
no test coverage detected