fixed rand interrupt, rotate functions