moved srand to kpuzzle_init