This set of scripts will generate levels similar to those found in Nuclear Throne. They are created via cellular automata, and the scripts are all well commented
There is only one script you need to call, to generate a level
generator_make_level(grid_size,fill_percent,smoothness,chests,enemies)
Contents
End User Licence Agreement (EULA).