error generating random number fixed