Here is a little snippet for anyone who needs it. What it does? Generates a random character string, stores it to a session variable (for verification), then renders a png image with a white background and random colors of the random characters. Change any variables you need. And call…