Add deterministic random seed to on-off generator.
Refactor code to purge all global variables.