MPI: rand() gives the same constant numbers across all processes in every run You have to seed your random number generator, eg srand(time(NULL) + rank);