Add cross-platform rand()