Actually instead of loading random image. While implementing CAPTCHA we usually display only a single plain image and add the text to that image randomly.
So here we will generate only text randomly:
Here is an excellent demo how can we generate a random string and show on image:
Hope this helps!