Fix uninitialized variable in SequenceModule::Update.

Also refactoring.
Refatoring RandomModule, and unique_ptrs.