Notes: This password generator is built using Java's "SecureRandom" cryptographically-secure pseudo-random number generator (CSPRNG) functionality, and generates valid, secure passwords for use on websites. Any time something is randomized in any part of this class, it is using SecureRandom and not a non-secure PRNG.
There are two helper methods: validatePassword(), which validates that a password has the set requirements for use on a website (at least one of each of the uppercase letters, lowercase letters, numerals, and- if the parameter for symbols is 'true'- symbols); and mergeCharLists(), which merges an array of char arrays (no, that's not a typo) into a single, randomized char array (or char list) for use by the two password generator methods. The two generator methods- standardMode() and alphaNumeric()- only differ in the char list they use to construct passwords, where standardMode() uses symbols and alphaNumeric() does not. They both call the mergeCharLists() method to construct their randomized char list from the available char arrays, use a for loop to generate a password of length specified by the parameters, and validate then return the password using validatePassword().
You can also view and download the code by visiting the GitHub repository HERE.
Disclaimer: All of this code is listed here as samples of the work I've done both inside and outside of the classroom here at Ole Miss. Many of these coding samples were done as part of a project for a class I belonged to, or were done for my own personal practice from other years' programming assignments; if this is the case, I have labeled it with the relevant University of Mississippi course number. My code may or may not be correct- it is simply posted with the intent to serve as a demonstration of my growth over time as a programmer, and for the work to serve as a guide to other programmers who are attempting to learn the craft themselves. I DO NOT recommend copying any of my code verbatim under any circumstances due to the risk of academic disciplinary measures being taken against you, and I am NOT responsible if this or any other negative result occurs from use of my code. Using or viewing this code in any way constitutes an affirmation that you have read and consent to this disclaimer, and to the terms of the provided GNU AGPLv3 License. The full license can be found HERE.