Fixed issue reported by sonar: Bad practice - Random object created and used only once.