#include <stdio.h>
#include <mpi.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
    int rank;
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    if (rank == 0) {
        srand(2);
        int random = rand();
        MPI_Send(&random, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
        printf("rank 0 random: %d \t", random);
    } else if (rank == 1) {
        int random;
        MPI_Recv(&random, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
        printf("rank 1, random: %d", random);
    }
    MPI_Finalize();
}
