srand initialization moved