refactored securerandom to model