Fixing randomgenerator error