Use srand and rand to properly cross platform.