moved srand to somewhere smart