Refactored and optimized RNG
Refactored and optimized RNG