Automate random shape generator and export viewport render with python
range(0,1) just generates a list containing only '0', so that's only looping once. I presume you had it set like that just for testing.

When I ran your script it crashed on the bpy.ops.file.filenum(increment=1) line. Changing context can be complicated, so I'd suggest instead controlling the filepath directly by assigning bpy.data.scenes['Scene'].render.filepath, and numerically increasing it yourself using the x variable.

Also, you don't need to call both bpy.ops.render.opengl() and bpy.ops.render.render(). The former is the one you want - you just need to pass it either animation=True or write_still=True to specify what it should save, while the latter render function is the full-on F12 'render', which requires a camera.

To give a different seed to the shape_generator call each time, you can use the x loop variable added on to whatever base seed you want. For example, if you loop for x in range(6) that will repeat with x == 0 the first time, up to x == 5 the last time.

Here's a version showing these suggestions.

import bpy
from os.path import join

folder = "C:\\Users\\acro\\random_shapes\\"
scn = bpy.data.scenes['Scene']

for x in range(42):
    bpy.ops.mesh.shape_generator(random_seed=1000+x, update_draw_only=True, show_seed_panel=True)
    # set the save destination:
    fname = "randomShape_%02d.png" % x
    scn.render.filepath = join(folder, fname)
    bpy.ops.render.opengl(write_still=True)

    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete(use_global=False)